summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-03 15:37:31 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-03 15:37:31 +0000
commit5cf8d67bc93050002c32d37e0d2fc8a3a500a7fa (patch)
treea46ba05be611b6752ca86f21a0d5a91b7e8db4bd /clang/lib/Sema/SemaDeclCXX.cpp
parent95c70ec678b9584c7e7516d420b95176eb5a0e11 (diff)
downloadbcm5719-llvm-5cf8d67bc93050002c32d37e0d2fc8a3a500a7fa.tar.gz
bcm5719-llvm-5cf8d67bc93050002c32d37e0d2fc8a3a500a7fa.zip
When declaring a namespace alias, ignore previous declarations that
aren't in scope. Fixes PR7014. llvm-svn: 102915
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 1ca7a728f0a..0db0d9e3896 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -4004,9 +4004,13 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S,
LookupParsedName(R, S, &SS);
// Check if we have a previous declaration with the same name.
- if (NamedDecl *PrevDecl
- = LookupSingleName(S, Alias, AliasLoc, LookupOrdinaryName,
- ForRedeclaration)) {
+ NamedDecl *PrevDecl
+ = LookupSingleName(S, Alias, AliasLoc, LookupOrdinaryName,
+ ForRedeclaration);
+ if (PrevDecl && !isDeclInScope(PrevDecl, CurContext, S))
+ PrevDecl = 0;
+
+ if (PrevDecl) {
if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(PrevDecl)) {
// We already have an alias with the same name that points to the same
// namespace, so don't create a new one.
OpenPOWER on IntegriCloud