[cfe-commits] r102437 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/typedef-redecl.cpp
Douglas Gregor
dgregor at apple.com
Tue Apr 27 09:26:47 PDT 2010
Author: dgregor
Date: Tue Apr 27 11:26:47 2010
New Revision: 102437
URL: http://llvm.org/viewvc/llvm-project?rev=102437&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/typedef-redecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=102437&r1=102436&r2=102437&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Apr 27 11:26:47 2010
@@ -5029,7 +5029,8 @@
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);
Modified: cfe/trunk/test/SemaCXX/typedef-redecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typedef-redecl.cpp?rev=102437&r1=102436&r2=102437&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/typedef-redecl.cpp (original)
+++ cfe/trunk/test/SemaCXX/typedef-redecl.cpp Tue Apr 27 11:26:47 2010
@@ -37,3 +37,14 @@
using namespace a;
foo x;
}
+
+namespace PR6923 {
+ struct A;
+
+ extern "C" {
+ struct A;
+ typedef struct A A;
+ }
+
+ struct A;
+}
More information about the cfe-commits
mailing list