On 5/13/24 07:56, Nathaniel Shead wrote:
@@ -11751,9 +11767,16 @@ tsubst_friend_class (tree friend_tmpl, tree args)
if (tmpl != error_mark_node)
{
/* The new TMPL is not an instantiation of anything, so we
- forget its origins. We don't reset CLASSTYPE_TI_TEMPLATE
+ forget its origins. It is also not a specialization of
+ anything. We don't reset CLASSTYPE_TI_TEMPLATE
for the new type because that is supposed to be the
corresponding template decl, i.e., TMPL. */
+ spec_entry elt;
+ elt.tmpl = friend_tmpl;
+ elt.args = CLASSTYPE_TI_ARGS (TREE_TYPE (tmpl));
+ elt.spec = TREE_TYPE (tmpl);
+ type_specializations->remove_elt (&elt);
For GCC 14.2 let's guard this with if (modules_p ()); for GCC 15 it can be
unconditional. OK.
I'm looking to backport this patch to GCC 14 now that it's been on trunk
some time. Here's the patch I'm aiming to add (squashed with the
changes from r15-220-gec2365e07537e8) after cherrypicking the
prerequisite commit r15-58-g2faf040335f9b4; is this OK?
Or should I keep it as two separate commits to make the cherrypicking
more obvious? Not entirely sure on the etiquette around this.
It's OK to squash them, but it's typical to use -x (directly or via git
gcc-backport) to mention where a branch change was cherry-picked from,
and in this case it would make sense to edit in the second commit so
it's clear the backport includes both. OK that way.
Jason