[C++,COMMITTED] Add test for c++/92058
diff mbox series

Message ID 20191108213842.GA21634@redhat.com
State New
Headers show
Series
  • [C++,COMMITTED] Add test for c++/92058
Related show

Commit Message

Marek Polacek Nov. 8, 2019, 9:38 p.m. UTC
Another test for the constinit issue I fixed recently (c++/92134).

Tested on x86_64-linux, applying to trunk.

2019-11-08  Marek Polacek  <polacek@redhat.com>

	PR c++/92058 - constinit malfunction in static data member.
	* g++.dg/cpp2a/constinit15.C: New test.

Patch
diff mbox series

diff --git gcc/testsuite/g++.dg/cpp2a/constinit15.C gcc/testsuite/g++.dg/cpp2a/constinit15.C
new file mode 100644
index 00000000000..32594334330
--- /dev/null
+++ 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;
+}