re PR c++/71166 (ICE with nested constexpr/initializer)
authorMarek Polacek <polacek@redhat.com>
Fri, 13 Jan 2017 17:27:54 +0000 (17:27 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 13 Jan 2017 17:27:54 +0000 (17:27 +0000)
PR c++/71166
* g++.dg/cpp0x/constexpr-array18.C: New test.

From-SVN: r244450

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C [new file with mode: 0644]

index dba6a2c..e3f4499 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-13  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/71166
+       * g++.dg/cpp0x/constexpr-array18.C: New test.
+
 2017-01-13  Janne Blomqvist  <jb@gcc.gnu.org>
 
        PR fortran/78534
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C
new file mode 100644 (file)
index 0000000..0f2d86e
--- /dev/null
@@ -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();
+}