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

--- Comment #8 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:f99c1d5c5d24bf343cf19b487b774e3ab497b145

commit r16-8704-gf99c1d5c5d24bf343cf19b487b774e3ab497b145
Author: Jakub Jelinek <[email protected]>
Date:   Thu Apr 16 15:51:04 2026 +0200

    c++: Fix up expansion-stmt mangling ICE [PR124120]

    One of the reflect/* tests ICEs on Solaris but not on Linux (at least not
    when using recent glibc).
    I've tracked it down to a problem with expansion statements, due to the
    workaround we have for missing part of P2686R4 where we make some
artificial
    vars static.  Some of them (the __for_range and __for_begin) have
DECL_NAMEs
    (with a space in it) and so even when they are static, don't cause
problems.
    But the iter variable (in https://eel.is/c++draft/stmt.expand#5.2 ) is when
    constexpr still static and was nameless.
    Now, because it is constexpr and not odr used, it is optimized out, but if
    the TU also contains weakref attribute or something else that requires
    cgraph to construct assembler_name_hash, we ICE when trying to mangle
    the iter nameless variable.

    The following patch fixes that by giving it yet another artificial name.

    2026-04-16  Jakub Jelinek  <[email protected]>

            PR c++/124120
            * pt.cc (finish_expansion_stmt): Give iter variable an artificial
            name.

            * g++.dg/cpp26/expansion-stmt40.C: New test.

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

Reply via email to