[cfe-commits] [PATCH] Implement C++11 alias templates

Sebastian Redl sebastian.redl at getdesigned.at
Thu May 5 13:06:55 PDT 2011


On 03.05.2011, at 23:00, Richard Smith wrote:

> Hi again,
> 
> On Thu, April 28, 2011 22:02, Richard Smith wrote:
>> The attached patch implements C++11 alias templates.
>> 
>> I've added a new Decl node for alias templates: TypeAliasTemplateDecl.
>> Alias template specialization types also need to track the
>> non-canonicalized aliased type, so I've extended TemplateSpecializationType
>> to store a non-canonical QualType in the case where it refers to an alias
>> template.
> [...]
> 
> I noticed that AST serialization support was missing from the previous
> patch. Attached is a diff to apply on top of the previous patch to
> implement such support, and a complete patch rebased to ToT.
> 
> Review comments appreciated!

Awesome! Very thorough test cases.

One tiny little question, but this is ready to commit either way.

> Index: test/CXX/temp/temp.decls/p3.cpp
> ===================================================================
> --- test/CXX/temp/temp.decls/p3.cpp	(revision 0)
> +++ test/CXX/temp/temp.decls/p3.cpp	(revision 0)
> @@ -0,0 +1,8 @@
> +// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
> +
> +template<typename T> using A = int;
> +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}}


If the user is missing template<>, wouldn't that be a full specialization and thus should say "explicit specialization" in the error message?

Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110505/5d44a3ba/attachment.html>


More information about the cfe-commits mailing list