gcc/testsuite/g++.dg/cpp0x/constexpr-mutable6.C
raw| 1 | // PR c++/110463 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct U { |
| 5 | mutable int x = 1; |
| 6 | }; |
| 7 | |
| 8 | struct V { |
| 9 | mutable int y = 1+1; |
| 10 | }; |
| 11 | |
| 12 | int main() { |
| 13 | constexpr U u = {}; |
| 14 | constexpr int x = u.x; // { dg-error "mutable" } |
| 15 | |
| 16 | constexpr V v = {}; |
| 17 | constexpr int y = v.y; // { dg-error "mutable" } |
| 18 | } |