[Bug c++/101767] [11 Regression] Aggregate initialization fails for struct that has both unnamed struct and union fields

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 22 05:18:00 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101767

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:b94c95fc1199bfa2c7ab577921b07ef545976cac

commit r11-9677-gb94c95fc1199bfa2c7ab577921b07ef545976cac
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Mar 18 14:36:19 2022 -0400

    c++: designator and anon struct [PR101767]

    We found .x in the anonymous struct, but then didn't find .y there; we
    should decide that means we're done with the struct rather than that the
    code is wrong.

            PR c++/101767

    gcc/cp/ChangeLog:

            * decl.c (reshape_init_class): Back out of anon struct
            if a designator doesn't match.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/anon-struct10.C: New test.


More information about the Gcc-bugs mailing list