aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-22 15:24:46 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-22 15:24:46 +0000
commitfe7574b3adc7b38e70dc4ecd335e8c9b38ab549f (patch)
tree749761a5a4865a41fc89ee1fcf68b3cf0edfbd86 /lib/Sema/SemaDeclCXX.cpp
parent9bd1d8d174a9d15ae343246c8322299248b9e92a (diff)
When performing name lookup for a namespace definition, only look into
the current context's redeclaration context, ignoring using directives. Fixes PR8430. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117097 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 2f3b2f4262..564dab49de 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -3216,15 +3216,17 @@ Decl *Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
if (II) {
// C++ [namespace.def]p2:
- // The identifier in an original-namespace-definition shall not have been
- // previously defined in the declarative region in which the
- // original-namespace-definition appears. The identifier in an
- // original-namespace-definition is the name of the namespace. Subsequently
- // in that declarative region, it is treated as an original-namespace-name.
-
- NamedDecl *PrevDecl
- = LookupSingleName(DeclRegionScope, II, IdentLoc, LookupOrdinaryName,
- ForRedeclaration);
+ // The identifier in an original-namespace-definition shall not
+ // have been previously defined in the declarative region in
+ // which the original-namespace-definition appears. The
+ // identifier in an original-namespace-definition is the name of
+ // the namespace. Subsequently in that declarative region, it is
+ // treated as an original-namespace-name.
+ //
+ // Since namespace names are unique in their scope, and we don't
+ // look through using directives, just
+ DeclContext::lookup_result R = CurContext->getRedeclContext()->lookup(II);
+ NamedDecl *PrevDecl = R.first == R.second? 0 : *R.first;
if (NamespaceDecl *OrigNS = dyn_cast_or_null<NamespaceDecl>(PrevDecl)) {
// This is an extended namespace definition.