For the code: /**************/ struct f1 {int x,y;}; struct f2 {int x,y,z,t;}; struct T { const char * name; union { struct f1 fn1; struct f2 fn2; } d; }; extern "C" void p(struct T); int main(){ p({"%x",{.fn2={1,2,3,4}}}); } /******************/ gcc 7.3 generates: <source>: In function 'int main()': <source>:15:26: internal compiler error: in reshape_init_class, at cp/decl.c:5802 p({"%x",{.fn2={1,2,3,4}}}); ^ mmap: Invalid argument gcc 8.1/8.2: <source>: In function 'int main()': <source>:15:26: error: could not convert '{"%x", {{1, 2, 3, 4}}}' from '<brace-enclosed initializer list>' to 'T' p({"%x",{.fn2={1,2,3,4}}}); ^ Compiler returned: 1 At the same time Clang starting 3.1 and higher generates valid code. Testing done using https://godbolt.org/
Fixed by r269371.
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:4f0aa5b051c0d3e81478bcb495e4e072b2d9827d commit r11-3268-g4f0aa5b051c0d3e81478bcb495e4e072b2d9827d Author: Marek Polacek <polacek@redhat.com> Date: Thu Sep 17 15:31:50 2020 -0400 c++: Add tests for fixed PRs. Bugzilla inspection turned up a bunch of old(er) PRs that have been fixed. Let's include them not to regress in the future. gcc/testsuite/ChangeLog: PR c++/87530 PR c++/58156 PR c++/68828 PR c++/86002 PR c++/91525 PR c++/96223 PR c++/87032 PR c++/35098 * g++.dg/cpp0x/move-return4.C: New test. * g++.dg/cpp0x/vt-58156.C: New test. * g++.dg/cpp2a/concepts-pr68828.C: New test. * g++.dg/cpp2a/concepts-pr86002.C: New test. * g++.dg/cpp2a/concepts-pr91525.C: New test. * g++.dg/cpp2a/constexpr-indeterminate1.C: New test. * g++.dg/cpp2a/desig17.C: New test. * g++.dg/ext/attrib62.C: New test.
Fixed.