gcc/testsuite/g++.dg/cpp0x/constexpr-48324.C
raw| 1 | // PR c++/48324 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct S { |
| 5 | const int val; |
| 6 | constexpr S(int i) : val(i) { } |
| 7 | }; |
| 8 | |
| 9 | constexpr const int& to_ref(int i) { |
| 10 | return S(i).val; // { dg-message "reference to temporary" } |
| 11 | } |
| 12 | |
| 13 | constexpr int ary[to_ref(98)] = { }; // { dg-error "25:size of array .ary. is not an integral" } |