================ @@ -8229,24 +8229,37 @@ Sema::CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams) { // C++ [temp.class.spec]p6: [P2096] // A partial specialization may be declared in any scope in which the // corresponding primary template may be defined. + auto FindTemplateParamsLoc = [](TemplateParameterList *TemplateParams, + SourceLocation Fallback) { + SourceLocation DiagLoc = TemplateParams->getTemplateLoc(); + if (DiagLoc.isValid()) + return DiagLoc; + + for (const NamedDecl *Param : *TemplateParams) + if (Param && Param->getLocation().isValid()) + return Param->getLocation(); + + return Fallback; + }; + if (Ctx) { if (Ctx->isFileContext()) return false; if (CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Ctx)) { // C++ [temp.mem]p2: // A local class shall not have member templates. - if (RD->isLocalClass()) - return Diag(TemplateParams->getTemplateLoc(), + if (RD->isLocalClass()) { ---------------- emily-dror wrote:
Oops, thanks for pointing that out. I'll change it :) https://github.com/llvm/llvm-project/pull/149781 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits