https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125555
--- Comment #6 from Leander Schulten <leander.schulten at tetys dot de> ---
I asked claude back then when creating the issue and it came up with
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index d81db520bab83..1329c6e646b43 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -15449,7 +15449,18 @@ depset::hash::add_specializations (bool decl_p)
else if (is_friend)
{
if (TI_TEMPLATE (ti) != entry->tmpl
- || !template_args_equal (TI_ARGS (ti), entry->tmpl))
+ && template_args_equal (TI_ARGS (ti), entry->args))
+ /* SPEC is an implicit instantiation of a hidden friend
+ template. It is keyed in the specialization table to
+ the most general template (ENTRY->TMPL), but it was
+ produced from the per-class pseudo-instantiation of the
+ friend (TI_TEMPLATE). This is a genuine specialization
+ that importers must be able to merge with equivalent
+ instantiations of their own, so record it as an ordinary
+ specialization rather than dropping it as a friend clone
+ (PR c++/125552). */
+ is_friend = false;
+ else
goto template_friend;
}
}
with tests and commit msg:
https://github.com/autoantwort/gcc/commit/44074a193ddc506296b47c1fc1d05d772f8ff871