[cfe-commits] r132431 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp

Douglas Gregor dgregor at apple.com
Wed Jun 1 15:37:07 PDT 2011


Author: dgregor
Date: Wed Jun  1 17:37:07 2011
New Revision: 132431

URL: http://llvm.org/viewvc/llvm-project?rev=132431&view=rev
Log:
Fix an incorrect warning about explicit template specializations for
nested types, from Michael Han!

Modified:
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=132431&r1=132430&r2=132431&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Jun  1 17:37:07 2011
@@ -1650,7 +1650,7 @@
         if (Spec->getSpecializationKind() != TSK_ExplicitSpecialization)
           NeedEmptyTemplateHeader = true;
         else
-          break;
+          continue;
       } else if (Record->getTemplateSpecializationKind()) {
         if (Record->getTemplateSpecializationKind() 
                                                 != TSK_ExplicitSpecialization &&

Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp?rev=132431&r1=132430&r2=132431&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp Wed Jun  1 17:37:07 2011
@@ -176,3 +176,34 @@
   template<class B>
   class S<A>::F{};
 }
+
+namespace template_class_spec_perClassDecl_nested
+{
+  template <typename T1> struct A {
+    template <typename T2> struct B {
+      template <typename T3> struct C {
+        static void foo();
+      };
+    };
+  };
+
+  template <> struct A<int> {
+    template <typename T2> struct B {
+      template <typename T3> struct C {
+        static void foo();
+      };
+    };
+  };
+
+  template <> template <typename T3> struct A<int>::B<int>::C {
+    static void foo();
+  };
+
+  template <> template <> struct A<int>::B<int>::C<int> {
+    static void foo();
+  };
+
+  template <> template<> template <typename T2> struct A<bool>::B<bool>::C {
+    static void foo();
+  };
+}





More information about the cfe-commits mailing list