gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr7.C
raw| 1 | // PR c++/49290 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | typedef unsigned T; |
| 5 | struct S |
| 6 | { |
| 7 | constexpr T foo (void); |
| 8 | unsigned s1[16]; |
| 9 | }; |
| 10 | |
| 11 | constexpr T |
| 12 | S::foo () |
| 13 | { |
| 14 | return *(T *) (s1 + 10); |
| 15 | } |
| 16 | |
| 17 | constexpr S s = { 0,1,2,3,4,5,6,7,8,9,10 }; |
| 18 | |
| 19 | #define SA(X) static_assert ((X), #X) |
| 20 | SA(s.foo() == 10); // { dg-error "discards qualifiers" "" { target c++14 } } |