PR c++/92058 - constinit malfunction in static data member.
authorMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 8 Nov 2019 21:40:45 +0000 (21:40 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 8 Nov 2019 21:40:45 +0000 (21:40 +0000)
* g++.dg/cpp2a/constinit15.C: New test.

From-SVN: r277990

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/constinit15.C [new file with mode: 0644]

index 0c16e5a2ebb2bf6993802534bc141793b1b28371..cafb7814f744ae12c27787d9d073bf16a84ca896 100644 (file)
@@ -1,5 +1,10 @@
-2019-11-08 Mark Eggleston <mark.eggleston@codethink.com>
-       Jim MacArthur <jim.macarthur@codethink.co.uk>
+2019-11-08  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/92058 - constinit malfunction in static data member.
+       * g++.dg/cpp2a/constinit15.C: New test.
+
+2019-11-08  Mark Eggleston  <mark.eggleston@codethink.com>
+           Jim MacArthur  <jim.macarthur@codethink.co.uk>
 
        * 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 (file)
index 0000000..3259433
--- /dev/null
@@ -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;
+}