https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105925
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:d610ae121e8ecd738de4dc01e6ac11ecf7c2327e commit r13-1226-gd610ae121e8ecd738de4dc01e6ac11ecf7c2327e Author: Jason Merrill <ja...@redhat.com> Date: Thu Jun 23 16:04:02 2022 -0400 c++: anon union designated init [PR105925] This testcase was failing because CONSTRUCTOR_IS_DESIGNATED_INIT wasn't getting set on the introduced CONSTRUCTOR for the anonymous union, and build_aggr_conv uses that flag to decide whether to pay attention to the indexes of the CONSTRUCTOR. So set the flag when we see a designator rather than relying on copying it from another CONSTRUCTOR. This avoids some redundant errors on desig4.C because we stop setting CONSTRUCTOR_IS_DESIGNATED_INIT on _Complex CONSTRUCTORs where it's nonsense. PR c++/105925 gcc/cp/ChangeLog: * decl.cc (reshape_init_array_1): Set CONSTRUCTOR_IS_DESIGNATED_INIT here. (reshape_init_class): And here. (reshape_init): Not here. gcc/testsuite/ChangeLog: * g++.dg/ext/desig4.C: Remove extra errors. * g++.dg/cpp2a/desig26.C: New test.