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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Jakub Jelinek
<[email protected]>:

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

commit r16-9512-gfac66e827216a5593fdf501929babf01338a4e79
Author: Jakub Jelinek <[email protected]>
Date:   Thu Aug 6 13:24:08 2026 +0200

    c++: Fix mangling of empty anon union/struct unnamed NSDMs [PR125541]

    Non-static data members are currently mangled as
    dm <prefix> <unqualified-name>
    This works fine for NSDMs with a name, or even the unnamed anon
union/struct
    NSDMs iff they have any named members in them (in that case the
    <unqualified-name> is using anon_aggr_naming_decl).
    As the following testcases show, if the anon union/struct is empty,
    we ICE, because there is nothing we can print as the name.
    The following patch mangles it similarly to unnamed bitfields in that case,
    simply counts the index of such problematic empty unnamed anon union/struct
    within the class and emits _ for the first one, etc.

    2026-06-12  Jakub Jelinek  <[email protected]>

            PR c++/125541
            * mangle.cc (write_reflection): Mangle empty anonymous union/struct
            data members as "da" rather than "dm" and use index of such a data
            member instead of name.

            * g++.dg/reflect/mangle1.C: Add further 2 tests.
            * g++.dg/reflect/mangle9.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>
    (cherry picked from commit 24754ac2629968fba1681ba51a96ed5bfd51546f)

Reply via email to