C++ PATCH to add test for c++/70156

Message ID 20190514210938.GG18891@redhat.com
State New
Headers show
Series
  • C++ PATCH to add test for c++/70156
Related show

Commit Message

Marek Polacek May 14, 2019, 9:09 p.m.
This got fixed by r254461.

Tested on x86_64-linux, applying to trunk.

2019-05-14  Marek Polacek  <polacek@redhat.com>

	PR c++/70156
	* g++.dg/init/static5.C: New test.

Patch

diff --git gcc/testsuite/g++.dg/init/static5.C gcc/testsuite/g++.dg/init/static5.C
new file mode 100644
index 00000000000..4eaf787d0d4
--- /dev/null
+++ gcc/testsuite/g++.dg/init/static5.C
@@ -0,0 +1,9 @@ 
+// PR c++/70156
+// { dg-do compile { target c++11 } }
+
+template <int> struct A { int i; };
+struct B { int i; };
+struct C {
+    static const A<0> a = { 0 }; // { dg-error ".constexpr. needed for in-class initialization of static data member" }
+    static const B b = { 1 }; // { dg-error ".constexpr. needed for in-class initialization of static data member" }
+};