Debian Codegraph @

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

raw
1 // PR c++/91360 - Implement C++20 P1143R2: constinit
2 // { dg-do compile { target c++20 } }
3 // Variable templates.
4
5 int nonconst;
6
7 template<typename T>
8 constinit T v1 = 42;
9
10 template<typename T>
11 constinit T v2 = nonconst; // { dg-error "does not have a constant initializer|not usable" }
12
13 void
14 fn ()
15 {
16 v1<int>;
17 v2<int>;
18 }