From: Marek Polacek Date: Fri, 8 Nov 2019 21:40:45 +0000 (+0000) Subject: PR c++/92058 - constinit malfunction in static data member. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a2dbbda892ac9e26fd7ebf6167363c58e5ed726b;p=gcc.git PR c++/92058 - constinit malfunction in static data member. * g++.dg/cpp2a/constinit15.C: New test. From-SVN: r277990 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c16e5a2ebb..cafb7814f74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ -2019-11-08 Mark Eggleston - Jim MacArthur +2019-11-08 Marek Polacek + + PR c++/92058 - constinit malfunction in static data member. + * g++.dg/cpp2a/constinit15.C: New test. + +2019-11-08 Mark Eggleston + Jim MacArthur * gfortran.dg/dec_char_conversion_in_assignment_1.f90: New test. * gfortran.dg/dec_char_conversion_in_assignment_2.f90: New test. diff --git a/gcc/testsuite/g++.dg/cpp2a/constinit15.C b/gcc/testsuite/g++.dg/cpp2a/constinit15.C new file mode 100644 index 00000000000..32594334330 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constinit15.C @@ -0,0 +1,14 @@ +// PR c++/92058 - constinit malfunction in static data member. +// { dg-do compile { target c++2a } } + +struct B { + B() {} +}; + +struct A { + constinit static inline B b1{}; // { dg-error "does not have a constant initializer|call to non-.constexpr. function" } +}; + +int main() { + A a; +}