blob: 8ea64cc0e1e45fd6e8654c5c7e4d5c0aa930e6fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// PR c++/91644 - ICE with constinit in function template.
// { dg-do compile { target c++11 } }
template <typename T>
static void fn1 ()
{
static __constinit auto v1 = 0;
static __constinit int v2 = 0;
}
int nonconst;
template <typename T>
static void fn2 ()
{
static __constinit auto v1 = nonconst; // { dg-error "does not have a constant initializer|not usable" }
static __constinit int v2 = nonconst; // { dg-error "does not have a constant initializer|not usable" }
}
template <typename T>
static void fn3 ()
{
static __constinit T v1 = 0;
static __constinit T v2 = nonconst; // { dg-error "does not have a constant initializer|not usable" }
}
void
g ()
{
fn1<int>();
fn2<int>();
fn3<int>();
}
|