aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-03-16 09:44:56 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-03-16 09:44:56 +0100
commitf664274af964fa1528b4be41f534ebb79c5a6a32 (patch)
tree7986a95fd404301264d3b7377253ee7cc7b79472 /gcc
parent057f9d20f193e883b8c4714c4444cd9513d0c187 (diff)
downloadgcc-f664274af964fa1528b4be41f534ebb79c5a6a32.zip
gcc-f664274af964fa1528b4be41f534ebb79c5a6a32.tar.gz
gcc-f664274af964fa1528b4be41f534ebb79c5a6a32.tar.bz2
re PR c++/84874 (internal compiler error: in reshape_init_class, at cp/decl.c:5800)
PR c++/84874 * g++.dg/cpp2a/desig8.C: New test. From-SVN: r258588
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/desig8.C31
2 files changed, 35 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4c03ff2..fdaa023 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,12 +1,15 @@
2018-03-16 Jakub Jelinek <jakub@redhat.com>
+ PR c++/84874
+ * g++.dg/cpp2a/desig8.C: New test.
+
PR tree-optimization/84841
* gcc.dg/pr84841.c: New test.
PR c++/84874
* g++.dg/cpp2a/desig7.C: New test.
-03-16-2018 Mark Doffman <mark.doffman@codethink.co.uk>
+2018-03-16 Mark Doffman <mark.doffman@codethink.co.uk>
Jim MacArthur <jim.macarthur@codethink.co.uk>
* gfortran.dg/automatic_1.f90: New test.
diff --git a/gcc/testsuite/g++.dg/cpp2a/desig8.C b/gcc/testsuite/g++.dg/cpp2a/desig8.C
new file mode 100644
index 0000000..d00d86f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/desig8.C
@@ -0,0 +1,31 @@
+// PR c++/84874
+// { dg-do run { target c++17 } }
+// { dg-options "" }
+
+struct A { int a; struct { int b; }; };
+struct B { A d; };
+
+void
+foo (B *x)
+{
+ *x = { .d = { .b = 5 } };
+}
+
+void
+bar (A *x)
+{
+ *x = { .b = 6 };
+}
+
+int
+main ()
+{
+ B b = { { 2, 3 } };
+ foo (&b);
+ if (b.d.a != 0 || b.d.b != 5)
+ __builtin_abort ();
+ b.d.a = 8;
+ bar (&b.d);
+ if (b.d.a != 0 || b.d.b != 6)
+ __builtin_abort ();
+}