gcc/testsuite/g++.dg/cpp0x/constexpr-base.C
raw| 1 | // Test base/member class and static_assert with constexpr |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct A { |
| 5 | int i; |
| 6 | constexpr A(int _i): i(_i) { } |
| 7 | }; |
| 8 | struct B: A { |
| 9 | A a; |
| 10 | int j; |
| 11 | constexpr B(int _ib, int _ia, int _j): A(_ib), a(_ia), j(_j) { } |
| 12 | }; |
| 13 | |
| 14 | constexpr B b (12, 24, 36); |
| 15 | |
| 16 | #define SA(X) static_assert (X, #X) |
| 17 | SA(b.i==12 && b.a.i==24 && b.j==36); |