Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/constinit7.C

raw
1 // PR c++/91360 - Implement C++20 P1143R2: constinit
2 // { dg-do compile { target c++11 } }
3
4 struct T {
5 constexpr T(int) {}
6 ~T();
7 };
8 __constinit T x = { 42 };
9 // ??? This should be rejected in C++14: copy initialization is not a constant
10 // expression on a non-literal type in C++14. But 'constinit' is C++20 only.
11 __constinit T y = 42;