From: Richard Smith Date: Wed, 1 Feb 2017 21:41:18 +0000 (+0000) Subject: Repoint 'missing typename' diagnostic to the location where 'typename' should be... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e83f1e3fdce9dbbeacf6dd813069433e977db23;p=clang Repoint 'missing typename' diagnostic to the location where 'typename' should be added. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293817 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index c565ab7c61..4c1acaadcb 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -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 diff --git a/test/CXX/temp/temp.res/p3.cpp b/test/CXX/temp/temp.res/p3.cpp index a836ff1b1b..ea87b8d105 100644 --- a/test/CXX/temp/temp.res/p3.cpp +++ b/test/CXX/temp/temp.res/p3.cpp @@ -12,7 +12,8 @@ struct X { }; }; -template A::B f1(); // expected-error {{missing 'typename' prior to dependent type template name 'A::B'}} +template A // expected-error {{missing 'typename' prior to dependent type template name 'A::B'}} + ::B f1(); template A::C f2(); // expected-error {{missing 'typename' prior to dependent type template name 'A::C'}} // FIXME: Should these cases really be valid? There doesn't appear to be a rule prohibiting them...