[Bug c++/126209] [16/17 regression] [mo dules] anonymous-namespace variable in a modu le partition → ICE in append_imported_bindi ng_slot (checking) / segfault in read_namespa ces after minutes-long spin (release)

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126209

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <[email protected]>:

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

commit r17-2831-gda9cb50722ba0341bab9d0bf29d1cfa12be18f42
Author: Jason Merrill <[email protected]>
Date:   Wed Jul 29 14:04:24 2026 -0400

    c++: anonymous namespace in module partition [PR126209]

    Here since r16-4484 we include all namespaces in the current purview in a
    module, even if the namespace comes from another partition.  That breaks
for
    an anonymous namespace, which is local to the TU (and added to the
    definition of TU-local entity by P2996 Reflection); here _c ended up
    representing the anonymous namespace from _a separately from the same one
    passed along from _b, leading to an ICE trying to import them into the same
    slot in _d.  I tried just adding namespaces to is_tu_local_entity, but that
    broke other things, so for 16.2 let's handle them here.

            PR c++/126209

    gcc/cp/ChangeLog:

            * module.cc (depset::hash::add_namespace_entities): Don't
            force out anonymous namespaces.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/anon-5_a.C: New test.
            * g++.dg/modules/anon-5_b.C: New test.
            * g++.dg/modules/anon-5_c.C: New test.
            * g++.dg/modules/anon-5_d.C: New test.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.