aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/IdentifierResolver.cpp3
-rw-r--r--test/SemaTemplate/class-template-spec.cpp19
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp
index ceab859c90..1e5fb26fb5 100644
--- a/lib/Sema/IdentifierResolver.cpp
+++ b/lib/Sema/IdentifierResolver.cpp
@@ -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.
diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp
index 71d8ea14be..34c616cc2f 100644
--- a/test/SemaTemplate/class-template-spec.cpp
+++ b/test/SemaTemplate/class-template-spec.cpp
@@ -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<>'}}