gcc/testsuite/g++.dg/cpp0x/constexpr-volatile.C
raw| 1 | // DR 1453 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct S { |
| 5 | constexpr S() : n{} { } |
| 6 | volatile int n; |
| 7 | }; |
| 8 | |
| 9 | constexpr S s; // { dg-error "literal" } |
| 10 | |
| 11 | struct Z { |
| 12 | volatile int m; |
| 13 | }; |
| 14 | |
| 15 | struct T { |
| 16 | constexpr T() : n{} { } |
| 17 | Z n; |
| 18 | }; |
| 19 | |
| 20 | constexpr T t; // { dg-error "literal" } |
| 21 | |
| 22 | struct U : Z { |
| 23 | constexpr U() : Z{} { } |
| 24 | }; |
| 25 | |
| 26 | constexpr U u; // { dg-error "literal" } |