r293817 - Repoint 'missing typename' diagnostic to the location where 'typename' should be added.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 1 13:41:18 PST 2017
Author: rsmith
Date: Wed Feb 1 15:41:18 2017
New Revision: 293817
URL: http://llvm.org/viewvc/llvm-project?rev=293817&view=rev
Log:
Repoint 'missing typename' diagnostic to the location where 'typename' should be added.
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/CXX/temp/temp.res/p3.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=293817&r1=293816&r2=293817&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Feb 1 15:41:18 2017
@@ -2440,7 +2440,7 @@ Sema::ActOnTemplateIdType(CXXScopeSpec &
// 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
Modified: cfe/trunk/test/CXX/temp/temp.res/p3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.res/p3.cpp?rev=293817&r1=293816&r2=293817&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.res/p3.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.res/p3.cpp Wed Feb 1 15:41:18 2017
@@ -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...
More information about the cfe-commits
mailing list