aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/constinit8.C
blob: 50bc13f2ce9f98e92de3586507dd98c4dad63edc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// PR c++/91360 - Implement C++20 P1143R2: constinit
// { dg-do compile { target c++20 } }
// Variable templates.

int nonconst;

template<typename T>
constinit T v1 = 42;

template<typename T>
constinit T v2 = nonconst; // { dg-error "does not have a constant initializer|not usable" }

void
fn ()
{
  v1<int>;
  v2<int>;
}