gcc/testsuite/g++.dg/cpp2a/constinit12.C
raw| 1 | // PR c++/91360 - Implement C++20 P1143R2: constinit |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | struct S { |
| 5 | S(int) { } |
| 6 | }; |
| 7 | |
| 8 | template <class T> |
| 9 | struct U { |
| 10 | T m; |
| 11 | constexpr U(int i) : m(i) { } // { dg-error "call to non-.constexpr. function" "" { target { ! implicit_constexpr } } } |
| 12 | }; |
| 13 | |
| 14 | constinit U<S> u(42); // { dg-error "does not have a constant initializer|called in a constant expression" "" { target { ! implicit_constexpr } } } |