Add test for c++/71166
Marek Polacek
polacek@redhat.com
Fri Jan 13 15:40:00 GMT 2017
This bug was fixed in r238395, so what remains to do for GCC 7 is to add a
testcase and close the PR.
Tested on x86_64-linux, ok for trunk?
2017-01-13 Marek Polacek <polacek@redhat.com>
PR c++/71166
* g++.dg/cpp0x/constexpr-array18.C: New test.
diff --git gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C
index e69de29..0f2d86e 100644
--- gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C
@@ -0,0 +1,23 @@
+// PR c++/71166
+// { dg-do compile { target c++11 } }
+
+struct Foo { int value; };
+
+constexpr Foo MakeFoo() { return Foo{0}; }
+
+struct Bar {
+ Foo color = MakeFoo();
+};
+
+struct BarContainer {
+ Bar array[1];
+};
+
+Foo X ()
+{
+ return MakeFoo ();
+}
+
+void Foo() {
+ new BarContainer();
+}
Marek
More information about the Gcc-patches
mailing list