From 14034026d6f1f45a4694e878a94089730be8ec5c Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 5 May 2011 22:36:10 +0000 Subject: [PATCH] Slight tweak to alias template error handling: don't guess that a template-id in an alias declaration was meant to be a specialization. Use a generic, but more accurate, diagnostic. llvm-svn: 130961 --- clang/lib/Parse/ParseDeclCXX.cpp | 3 ++- clang/test/CXX/temp/temp.decls/p3.cpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index ae6b3ff011ea..9c464bc24850 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -396,7 +396,8 @@ Decl *Parser::ParseUsingDeclaration(unsigned Context, // Type alias templates cannot be specialized. int SpecKind = -1; - if (Name.getKind() == UnqualifiedId::IK_TemplateId) + if (TemplateInfo.Kind == ParsedTemplateInfo::Template && + Name.getKind() == UnqualifiedId::IK_TemplateId) SpecKind = 0; if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitSpecialization) SpecKind = 1; diff --git a/clang/test/CXX/temp/temp.decls/p3.cpp b/clang/test/CXX/temp/temp.decls/p3.cpp index 21c82e6f2274..54800e4061ee 100644 --- a/clang/test/CXX/temp/temp.decls/p3.cpp +++ b/clang/test/CXX/temp/temp.decls/p3.cpp @@ -4,5 +4,4 @@ template using A = int; template using A = char; // expected-error {{partial specialization of alias templates is not permitted}} template<> using A = char; // expected-error {{explicit specialization of alias templates is not permitted}} template using A = char; // expected-error {{explicit instantiation of alias templates is not permitted}} -// Best guess as to what the user was trying to do: missing template<>. -using A = char; // expected-error {{partial specialization of alias templates is not permitted}} +using A = char; // expected-error {{name defined in alias declaration must be an identifier}}