[Bug c++/122699] [16 Regression] ICE in make_dependency, at cp/module.cc:14467
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122699 Nathaniel Shead changed: What|Removed |Added Status|NEW |RESOLVED Assignee|unassigned at gcc dot gnu.org |nshead at gcc dot gnu.org Resolution|--- |FIXED --- Comment #4 from Nathaniel Shead --- Should be fixed on trunk, thanks for the report!
[Bug c++/122699] [16 Regression] ICE in make_dependency, at cp/module.cc:14467
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122699 --- Comment #3 from GCC Commits --- The master branch has been updated by Nathaniel Shead : https://gcc.gnu.org/g:e0ac5e1c8a69fec114fc5896cf90b4c0b05240c5 commit r16-5584-ge0ac5e1c8a69fec114fc5896cf90b4c0b05240c5 Author: Nathaniel Shead Date: Sat Nov 22 22:30:32 2025 +1100 c++/modules: Walk indirectly exposed namespaces [PR122699] In some situations, such as friend injection, we may add an entity to a namespace without ever explicitly opening that namespace in this TU. We currently have an additional loop to make sure the namespace is considered purview, but this isn't sufficient to make walk_module_binding find it, since the namspace itself is not in the current TU's symbol table. This patch ensures we still process the (hidden) binding for the injected friend in this TU. PR c++/122699 gcc/cp/ChangeLog: * name-lookup.h (expose_existing_namespace): Declare. * name-lookup.cc (expose_existing_namespace): New function. (push_namespace): Call it. * pt.cc (tsubst_friend_function): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/tpl-friend-21_a.C: New test. * g++.dg/modules/tpl-friend-21_b.C: New test. Signed-off-by: Nathaniel Shead Reviewed-by: Jason Merrill
[Bug c++/122699] [16 Regression] ICE in make_dependency, at cp/module.cc:14467
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122699
--- Comment #2 from Nathaniel Shead ---
Reduced:
// a.cpp
export module M;
export namespace ns {
template struct S {
friend void f();
};
void f();
}
// b.cpp
export module X;
import M;
ns::S s;
[Bug c++/122699] [16 Regression] ICE in make_dependency, at cp/module.cc:14467
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122699 Richard Biener changed: What|Removed |Added Target Milestone|--- |16.0
[Bug c++/122699] [16 Regression] ICE in make_dependency, at cp/module.cc:14467
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122699 Nathaniel Shead changed: What|Removed |Added CC||nshead at gcc dot gnu.org Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Blocks||103524 Last reconfirmed||2025-11-16 Summary|ICE in make_dependency, at |[16 Regression] ICE in |cp/module.cc:14467 |make_dependency, at ||cp/module.cc:14467 Keywords||ice-checking --- Comment #1 from Nathaniel Shead --- Confirmed, looks like because of r16-5213 "c++/modules: Maintain attachment of temploid friends after duplicate_decls [PR122551]". The issue here is that `operator|` is now marked as purview and not as imported (as it's instantiated within M's purview); nevertheless we didn't add it to our local binding table and so we fail a checking assertion. Perhaps we should check 'imported_temploid_friends' to consider this an imported declaration as well... but then, maybe there's good reason we should be emitting these instantiations from this module as well. I'll need to think more and experiment, the behaviour of friends is quite complex and I'm sure I'm still missing something here. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524 [Bug 103524] [meta-bug] modules issue
