================ @@ -4159,7 +4159,7 @@ FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const { if (FunctionTemplateSpecializationInfo *Info = TemplateOrSpecialization .dyn_cast<FunctionTemplateSpecializationInfo*>()) { - return Info->getTemplate(); + return Info->getTemplate()->getMostRecentDecl(); ---------------- mizvekov wrote:
Changing the implementation of getPrimaryTemplate has a global effect, while you are interested in fixing a behavior specific to `getTemplateInstantiationPattern`. Why can't we fix this behavior there instead? I am worried about two things: * The most recent declaration is not always the *right* declaration you have to follow in order to get to the pattern. * We will degrade source fidelity for code currently using these helpers, as they won't be able to find the exact redeclaration for their primary template anymore. https://github.com/llvm/llvm-project/pull/111173 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits