[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 #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Jason Merrill <[email protected]>: https://gcc.gnu.org/g:8291c5c34585f61b74e0c3225e3ec25ebeef8c90 commit r16-9468-g8291c5c34585f61b74e0c3225e3ec25ebeef8c90 Author: Jason Merrill <[email protected]> Date: Thu Jul 30 13:29:28 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. (cherry picked from commit da9cb50722ba0341bab9d0bf29d1cfa12be18f42)