]> granicus.if.org Git - clang/commitdiff
Make sure to compare primary declaration contexts when determining whether a declarat...
authorDouglas Gregor <dgregor@apple.com>
Wed, 26 Aug 2009 18:54:58 +0000 (18:54 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 26 Aug 2009 18:54:58 +0000 (18:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80126 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/IdentifierResolver.cpp
test/SemaTemplate/class-template-spec.cpp

index ceab859c90aa025ba1d46a49e75a1b293afdb9a4..1e5fb26fb54073b230f2d504bb7356b5b8f8c6e8 100644 (file)
@@ -134,7 +134,8 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
     return false;
   }
 
-  return D->getDeclContext()->getLookupContext() == Ctx->getPrimaryContext();
+  return D->getDeclContext()->getLookupContext()->getPrimaryContext() == 
+    Ctx->getPrimaryContext();
 }
 
 /// AddDecl - Link the decl to its shadowed decl chain.
index 71d8ea14be6bb69cc73aa1f762b66697cd80e3b6..34c616cc2f42dd42edef3454b983f0945c17a358 100644 (file)
@@ -49,6 +49,25 @@ struct A<char> {
 
 A<char>::A() { }
 
+// Make sure we can see specializations defined before the primary template.
+namespace N{ 
+  template<typename T> struct A0;
+}
+
+namespace N {
+  template<>
+  struct A0<void> {
+    typedef void* pointer;
+  };
+}
+
+namespace N {
+  template<typename T>
+  struct A0 {
+    void foo(A0<void>::pointer p = 0);
+  };
+}
+
 // Diagnose specialization errors
 struct A<double> { }; // expected-error{{template specialization requires 'template<>'}}