]> granicus.if.org Git - clang/commitdiff
Repoint 'missing typename' diagnostic to the location where 'typename' should be...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 1 Feb 2017 21:41:18 +0000 (21:41 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 1 Feb 2017 21:41:18 +0000 (21:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293817 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplate.cpp
test/CXX/temp/temp.res/p3.cpp

index c565ab7c617a262ca71b93f7b5a054c9bfc8f51f..4c1acaadcba344271e9ca2d6cb8c038a88575d85 100644 (file)
@@ -2440,7 +2440,7 @@ Sema::ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
     //   qualified-id denotes a type, forming an
     //   elaborated-type-specifier (7.1.5.3).
     if (!LookupCtx && isDependentScopeSpecifier(SS)) {
-      Diag(TemplateIILoc, diag::err_typename_missing_template)
+      Diag(SS.getBeginLoc(), diag::err_typename_missing_template)
         << SS.getScopeRep() << TemplateII->getName();
       // Recover as if 'typename' were specified.
       // FIXME: This is not quite correct recovery as we don't transform SS
index a836ff1b1b46b520b5bfcca88dff9cecc90ff517..ea87b8d10546d4824c8a63cdce9021ddde474e31 100644 (file)
@@ -12,7 +12,8 @@ struct X {
   };
 };
 
-template<typename T> A<T>::B<T> f1(); // expected-error {{missing 'typename' prior to dependent type template name 'A<T>::B'}}
+template<typename T> A // expected-error {{missing 'typename' prior to dependent type template name 'A<T>::B'}}
+                      <T>::B<T> f1();
 template<typename T> A<T>::C<T> f2(); // expected-error {{missing 'typename' prior to dependent type template name 'A<T>::C'}}
 
 // FIXME: Should these cases really be valid? There doesn't appear to be a rule prohibiting them...