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

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

https://gcc.gnu.org/g:7c459132de478dbede44e323e195073e8d2bca55

commit r17-3784-g7c459132de478dbede44e323e195073e8d2bca55
Author: Jakub Jelinek <[email protected]>
Date:   Mon Aug 31 09:38:43 2026 +0200

    c++: Fix mangling of aggregates containing std::meta::info [PR126922]

    We ICE during mangling on the following testcase.
    There are two problems on it.
    One is the use of build_zero_cst for skipped members when
    using designated initializers.  build_zero_cst is a gcc/tree.cc
    function, so it doesn't know about META_TYPE and how to create a zero
    constant for it.
    We could call probably build_zero_init instead, but it does significantly
    more work and apparently (from what I've been playing with e.g. using
    pointer-to-data-member types etc.) it isn't needed except for the
reflection
    case, so this patch just calls get_null_reflection () for reflections
    and keeps using build_zero_cst for everything else.
    Another problem is that we mangle
    A { .a = {}, .b = {} }
    vs.
    A { .a = {} }
    differently, although both have the same value.  If a and b fields have
    pointer-to-data-member type instead (or int), the zero initialized members
    are skipped from the tl value list, and this patch changes zero_init_expr_p
    so that it handles null reflections the same way (before P4101 mangling
    is probably the only way to observe whether null reflection is all zeros or
    not).

    2026-08-31  Jakub Jelinek  <[email protected]>

            PR c++/126922
            * mangle.cc (write_expression): For CONSTRUCTOR skipped
            member of std::meta::info type, call write_expression on
            get_null_reflection rather than build_zero_cst.
            * tree.cc (zero_init_expr_p): If type is std::meta::info,
            return true iff t is null reflection.

            * g++.dg/reflect/mangle10.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to