re PR c++/89871 (Wall + designated initializers)
authorMarek Polacek <polacek@redhat.com>
Fri, 29 Mar 2019 15:24:00 +0000 (15:24 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 29 Mar 2019 15:24:00 +0000 (15:24 +0000)
PR c++/89871
* g++.dg/cpp2a/desig14.C: New test.

From-SVN: r270019

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/desig14.C [new file with mode: 0644]

index 08d0609e2e0d35030b2918aaf83bca6ceec658ed..0d954bfe2bb705ecf45cd69439686310c0c86c7d 100644 (file)
@@ -1,3 +1,8 @@
+2019-03-29  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/89871
+       * g++.dg/cpp2a/desig14.C: New test.
+
 2019-03-29  Martin Liska  <mliska@suse.cz>
 
        * gcc.dg/ipa/ipa-icf-39.c: Prine '***dbgcnt' output.
diff --git a/gcc/testsuite/g++.dg/cpp2a/desig14.C b/gcc/testsuite/g++.dg/cpp2a/desig14.C
new file mode 100644 (file)
index 0000000..cfcaa88
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/89871
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wall" }
+
+struct A {};
+struct B {};
+
+struct S {
+  union {
+    A a;
+    B b;
+  };
+};
+
+int main() {
+  S s;
+  s = S{.a = A{}};
+}