summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-07-16 07:45:46 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-07-16 07:45:46 +0000
commit7da34d050bed921ea22a605b8dcd4642b756687d (patch)
treefca43a1e68d4cb7774652cba26adec65cfc5e402 /clang/lib
parentc97094552c332ef6d29fa01ddfc20d0ba89b1901 (diff)
downloadbcm5719-llvm-7da34d050bed921ea22a605b8dcd4642b756687d.tar.gz
bcm5719-llvm-7da34d050bed921ea22a605b8dcd4642b756687d.zip
When checking for name collision between a tag and a previously defined namespace, the collision occured even when the tag was in a different nested scope.
Fix it by taking into account the scope when checking for namespace-tag name collisions. llvm-svn: 53667
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 4836be4b8ef..f4d9da60147 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1733,11 +1733,14 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
// scope, e.g. "struct foo; void bar() { struct foo; }", just create a new
// type.
} else {
- // The tag name clashes with a namespace name, issue an error and recover
- // by making this tag be anonymous.
- Diag(NameLoc, diag::err_redefinition_different_kind, Name->getName());
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
- Name = 0;
+ // PrevDecl is a namespace.
+ if (IdResolver.isDeclInScope(PrevDecl, CurContext, S)) {
+ // The tag name clashes with a namespace name, issue an error and recover
+ // by making this tag be anonymous.
+ Diag(NameLoc, diag::err_redefinition_different_kind, Name->getName());
+ Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Name = 0;
+ }
}
}
OpenPOWER on IntegriCloud