This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH to add test for c++/89871
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 29 Mar 2019 11:18:50 -0400
- Subject: C++ PATCH to add test for c++/89871
As per the PR.
Tested on x86_64-linux, applying to trunk.
2019-03-29 Marek Polacek <polacek@redhat.com>
PR c++/89871
* g++.dg/cpp2a/desig14.C: New test.
diff --git gcc/testsuite/g++.dg/cpp2a/desig14.C gcc/testsuite/g++.dg/cpp2a/desig14.C
new file mode 100644
index 00000000000..cfcaa88485c
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp2a/desig14.C
@@ -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{}};
+}