gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C
raw| 1 | // A constructor that might or might not be constexpr still makes |
| 2 | // its class literal. |
| 3 | // { dg-do compile { target c++11 } } |
| 4 | |
| 5 | template <class T> |
| 6 | struct B |
| 7 | { |
| 8 | constexpr B(T) { } |
| 9 | constexpr B() {} |
| 10 | }; |
| 11 | |
| 12 | struct A |
| 13 | { |
| 14 | B<A> b; |
| 15 | }; |
| 16 | |
| 17 | constexpr A a {}; |
| 18 | |
| 19 | template <class T> |
| 20 | struct C |
| 21 | { |
| 22 | constexpr C(T) { } |
| 23 | C() {} |
| 24 | }; |
| 25 | |
| 26 | struct D |
| 27 | { |
| 28 | C<D> c; |
| 29 | }; |
| 30 | |
| 31 | constexpr D d {}; // { dg-error "non-.constexpr. function" "" { target { ! implicit_constexpr } } } |