[cfe-commits] r71153 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/SemaTemplate/dependent-type-identity.cpp

Douglas Gregor dgregor at apple.com
Wed May 6 23:49:52 PDT 2009


Author: dgregor
Date: Thu May  7 01:49:52 2009
New Revision: 71153

URL: http://llvm.org/viewvc/llvm-project?rev=71153&view=rev
Log:
Compute the canonical template name when building a template
specialization type for a dependent template name.

Modified:
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=71153&r1=71152&r2=71153&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu May  7 01:49:52 2009
@@ -784,9 +784,10 @@
     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.

Modified: cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp?rev=71153&r1=71152&r2=71153&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp (original)
+++ cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp Thu May  7 01:49:52 2009
@@ -6,6 +6,7 @@
 template<typename T, typename U>
 struct X1 {
   typedef T type;
+  typedef U U_type;
 
   void f0(T); // expected-note{{previous}}
   void f0(U);
@@ -23,18 +24,14 @@
   void f3(X0<U>*);
   void f3(::X0<type>*); // expected-error{{redeclar}}  
 
-  void f4(typename T::template apply<U>*);
+  void f4(typename T::template apply<U>*); // expected-note{{previous}}
   void f4(typename U::template apply<U>*);
   void f4(typename type::template apply<T>*);
-  // 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<U>*);
+  void f4(typename type::template apply<U_type>*); // expected-error{{redeclar}}
 
-  void f5(typename T::template apply<U>::type*);
+  void f5(typename T::template apply<U>::type*); // expected-note{{previous}}
   void f5(typename U::template apply<U>::type*);
   void f5(typename U::template apply<T>::type*);
   void f5(typename type::template apply<T>::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<U>::type*);
+  void f5(typename type::template apply<U_type>::type*); // expected-error{{redeclar}}
 };





More information about the cfe-commits mailing list