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