This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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{}};
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]