aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-27 16:26:47 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-27 16:26:47 +0000
commitc8fd2dae17a0fc631a07ab7b66c9d3ebe90a0cc6 (patch)
tree84157d0e02c00f1046aab67d7ef1ca0d73f4f433
parenta6a292b4dc47da42b2fc0662af7fe278c9e9fb33 (diff)
When checking the redeclaration context of a typedef that refers to a
tag of the same name, compare the lookup contexts rather than the actual contexts. Fixes PR6923. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102437 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDecl.cpp3
-rw-r--r--test/SemaCXX/typedef-redecl.cpp11
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index d9696d9ed5..fcee68d474 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -5029,7 +5029,8 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
if (const TagType *TT = TD->getUnderlyingType()->getAs<TagType>()) {
TagDecl *Tag = TT->getDecl();
if (Tag->getDeclName() == Name &&
- Tag->getDeclContext()->Equals(TD->getDeclContext())) {
+ Tag->getDeclContext()->getLookupContext()
+ ->Equals(TD->getDeclContext()->getLookupContext())) {
PrevDecl = Tag;
Previous.clear();
Previous.addDecl(Tag);
diff --git a/test/SemaCXX/typedef-redecl.cpp b/test/SemaCXX/typedef-redecl.cpp
index 2acf6757fa..49e1f3aa79 100644
--- a/test/SemaCXX/typedef-redecl.cpp
+++ b/test/SemaCXX/typedef-redecl.cpp
@@ -37,3 +37,14 @@ namespace test1 {
using namespace a;
foo x;
}
+
+namespace PR6923 {
+ struct A;
+
+ extern "C" {
+ struct A;
+ typedef struct A A;
+ }
+
+ struct A;
+}