As per the PR. Tested on x86_64-linux, applying to trunk.
2019-03-29 Marek Polacek <pola...@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{}}; +}