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.

llvm-svn: 102437
This commit is contained in:
Douglas Gregor 2010-04-27 16:26:47 +00:00
parent 19defcd6f5
commit 4423926e66
2 changed files with 13 additions and 1 deletions

View File

@ -5029,7 +5029,8 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
if (const TagType *TT = TD->getUnderlyingType()->getAs<TagType>()) { if (const TagType *TT = TD->getUnderlyingType()->getAs<TagType>()) {
TagDecl *Tag = TT->getDecl(); TagDecl *Tag = TT->getDecl();
if (Tag->getDeclName() == Name && if (Tag->getDeclName() == Name &&
Tag->getDeclContext()->Equals(TD->getDeclContext())) { Tag->getDeclContext()->getLookupContext()
->Equals(TD->getDeclContext()->getLookupContext())) {
PrevDecl = Tag; PrevDecl = Tag;
Previous.clear(); Previous.clear();
Previous.addDecl(Tag); Previous.addDecl(Tag);

View File

@ -37,3 +37,14 @@ namespace test1 {
using namespace a; using namespace a;
foo x; foo x;
} }
namespace PR6923 {
struct A;
extern "C" {
struct A;
typedef struct A A;
}
struct A;
}