[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 08:06:52 PST 2024


================
@@ -4394,8 +4394,14 @@ NestedNameSpecifierLoc TreeTransform<Derived>::TransformNestedNameSpecifierLoc(
           SS.Adopt(ETL.getQualifierLoc());
           TL = ETL.getNamedTypeLoc();
         }
-        SS.Extend(SemaRef.Context, /*FIXME:*/ SourceLocation(), TL,
-                  Q.getLocalEndLoc());
+        SourceLocation TemplateKWLoc;
+        if (const auto TSTL = TL.getAs<TemplateSpecializationTypeLoc>())
+          TemplateKWLoc = TSTL.getTemplateKeywordLoc();
+        else if (const auto DTSTL =
+                     TL.getAs<DependentTemplateSpecializationTypeLoc>())
+          TemplateKWLoc = DTSTL.getTemplateKeywordLoc();
----------------
cor3ntin wrote:

Yes, we should make a function :)

https://github.com/llvm/llvm-project/pull/78595


More information about the cfe-commits mailing list