From: Douglas Gregor Date: Thu, 7 May 2009 06:49:52 +0000 (+0000) Subject: Compute the canonical template name when building a template X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=45fbaf02fb94a9bc6a108c9621d3db0092d11e94;p=clang Compute the canonical template name when building a template specialization type for a dependent template name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71153 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 6c4adbd0ae..e62b9a26c0 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -784,9 +784,10 @@ QualType Sema::CheckTemplateIdType(TemplateName Name, CanonicalizeTemplateArguments(TemplateArgs, NumTemplateArgs, CanonicalTemplateArgs, Context); - // FIXME: Get the canonical template-name + TemplateName CanonName = Context.getCanonicalTemplateName(Name); QualType CanonType - = Context.getTemplateSpecializationType(Name, &CanonicalTemplateArgs[0], + = Context.getTemplateSpecializationType(CanonName, + &CanonicalTemplateArgs[0], CanonicalTemplateArgs.size()); // Build the dependent template-id type. diff --git a/test/SemaTemplate/dependent-type-identity.cpp b/test/SemaTemplate/dependent-type-identity.cpp index 0cb5534ca5..98fc2a8c6e 100644 --- a/test/SemaTemplate/dependent-type-identity.cpp +++ b/test/SemaTemplate/dependent-type-identity.cpp @@ -6,6 +6,7 @@ struct X0 { }; template struct X1 { typedef T type; + typedef U U_type; void f0(T); // expected-note{{previous}} void f0(U); @@ -23,18 +24,14 @@ struct X1 { void f3(X0*); void f3(::X0*); // expected-error{{redeclar}} - void f4(typename T::template apply*); + void f4(typename T::template apply*); // expected-note{{previous}} void f4(typename U::template apply*); void f4(typename type::template apply*); - // FIXME: this is a duplicate of the first f4, but we are not fully - // canonicalizing nested-name-specifiers yet. - void f4(typename type::template apply*); + void f4(typename type::template apply*); // expected-error{{redeclar}} - void f5(typename T::template apply::type*); + void f5(typename T::template apply::type*); // expected-note{{previous}} void f5(typename U::template apply::type*); void f5(typename U::template apply::type*); void f5(typename type::template apply::type*); - // FIXME: this is a duplicate of the first f5, but we are not fully - // canonicalizing nested-name-specifiers yet. - void f5(typename type::template apply::type*); + void f5(typename type::template apply::type*); // expected-error{{redeclar}} };