summaryrefslogtreecommitdiff
path: root/lib/Sema/IdentifierResolver.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-03-07 16:54:27 +0000
committerDouglas Gregor <dgregor@apple.com>2011-03-07 16:54:27 +0000
commitcc20945c787a56abe418947fc6a2c520bcec66c0 (patch)
tree3c3ff3e18927a91b57b0e7622266000d72719d26 /lib/Sema/IdentifierResolver.cpp
parent944cdae86ecb2ab5deda96804099bd28f6a6cd39 (diff)
downloadclang-cc20945c787a56abe418947fc6a2c520bcec66c0.tar.gz
Support explicit template specialization and instantiation for members
of a C++0x inline namespace within enclosing namespaces, as noted in C++0x [namespace.def]p8. Fixes <rdar://problem/9006349>, a libc++ failure where Clang was rejected an explicit specialization of std::swap (since libc++ puts it into an inline, versioned namespace std::__1). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127162 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/IdentifierResolver.cpp')
-rw-r--r--lib/Sema/IdentifierResolver.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp
index 3f16ed7723..10856225ad 100644
--- a/lib/Sema/IdentifierResolver.cpp
+++ b/lib/Sema/IdentifierResolver.cpp
@@ -104,7 +104,8 @@ IdentifierResolver::~IdentifierResolver() {
/// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
/// true if 'D' belongs to the given declaration context.
bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
- ASTContext &Context, Scope *S) const {
+ ASTContext &Context, Scope *S,
+ bool ExplicitInstantiationOrSpecialization) const {
Ctx = Ctx->getRedeclContext();
if (Ctx->isFunctionOrMethod()) {
@@ -135,7 +136,10 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
return false;
}
- return D->getDeclContext()->getRedeclContext()->Equals(Ctx);
+ DeclContext *DCtx = D->getDeclContext()->getRedeclContext();
+ return ExplicitInstantiationOrSpecialization
+ ? Ctx->InEnclosingNamespaceSetOf(DCtx)
+ : Ctx->Equals(DCtx);
}
/// AddDecl - Link the decl to its shadowed decl chain.