PR c++/84874
* g++.dg/cpp2a/desig8.C: New test.
From-SVN: r258588
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.
--- /dev/null
+// 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 ();
+}