gcc/testsuite/g++.dg/cpp0x/constexpr-mutable4.C
raw| 1 | // PR c++/109745 |
| 2 | // Similar to constexpr-mutable1.C, but with nested 'mutable' accesses. |
| 3 | // { dg-do compile { target c++11 } } |
| 4 | |
| 5 | struct A { mutable int m = 0; }; |
| 6 | |
| 7 | struct B { A a; }; |
| 8 | |
| 9 | struct C { B b; }; |
| 10 | |
| 11 | constexpr B b; |
| 12 | constexpr int bam = b.a.m; // { dg-error "mutable" } |
| 13 | |
| 14 | constexpr C c; |
| 15 | constexpr int cbam = c.b.a.m; // { dg-error "mutable" } |