Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp2a/constinit13.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
line wrap: on
line source
// 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>(); }