[cfe-commits] r130961 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/CXX/temp/temp.decls/p3.cpp

Richard Smith richard-llvm at metafoo.co.uk
Thu May 5 15:36:10 PDT 2011


Author: rsmith
Date: Thu May  5 17:36:10 2011
New Revision: 130961

URL: http://llvm.org/viewvc/llvm-project?rev=130961&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/test/CXX/temp/temp.decls/p3.cpp

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=130961&r1=130960&r2=130961&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Thu May  5 17:36:10 2011
@@ -396,7 +396,8 @@
 
     // 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;

Modified: cfe/trunk/test/CXX/temp/temp.decls/p3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.decls/p3.cpp?rev=130961&r1=130960&r2=130961&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.decls/p3.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.decls/p3.cpp Thu May  5 17:36:10 2011
@@ -4,5 +4,4 @@
 template<typename T> using A<T*> = char; // expected-error {{partial specialization of alias templates is not permitted}}
 template<> using A<char> = char; // expected-error {{explicit specialization of alias templates is not permitted}}
 template using A<char> = 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> = char; // expected-error {{partial specialization of alias templates is not permitted}}
+using A<char> = char; // expected-error {{name defined in alias declaration must be an identifier}}





More information about the cfe-commits mailing list