================ @@ -5751,14 +5751,16 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, RebuildTypeSourceInfoForDefaultSpecialMembers(); SetDeclDefaulted(Function, PatternDecl->getLocation()); } else { - NamedDecl *ND = Function; - DeclContext *DC = ND->getLexicalDeclContext(); + DeclContext *DC = Function->getLexicalDeclContext(); std::optional<ArrayRef<TemplateArgument>> Innermost; - if (auto *Primary = Function->getPrimaryTemplate(); - Primary && + bool NeedDCFromPrimaryTemplate = !isGenericLambdaCallOperatorOrStaticInvokerSpecialization(Function) && Function->getTemplateSpecializationKind() != - TSK_ExplicitSpecialization) { + TSK_ExplicitSpecialization && + !PatternDecl->getDependentSpecializationInfo(); ---------------- zyn0217 wrote:
I am also considering to have these instantiations 1) never track the primary template in these cases 2) or track the invalid explicit specialization as its primary template (this likely isn't doable because the specialization is not a template). Neither option seems ideal to me https://github.com/llvm/llvm-project/pull/139436 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits