forked from OSchip/llvm-project
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:
parent
19defcd6f5
commit
4423926e66
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue