Index: cfe/trunk/lib/Sema/SemaDecl.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaDecl.cpp +++ cfe/trunk/lib/Sema/SemaDecl.cpp @@ -6935,7 +6935,7 @@ } } - DeclContext *OldDC = ShadowedDecl->getDeclContext(); + DeclContext *OldDC = ShadowedDecl->getDeclContext()->getRedeclContext(); unsigned WarningDiag = diag::warn_decl_shadow; SourceLocation CaptureLoc; Index: cfe/trunk/test/SemaCXX/warn-shadow.cpp =================================================================== --- cfe/trunk/test/SemaCXX/warn-shadow.cpp +++ cfe/trunk/test/SemaCXX/warn-shadow.cpp @@ -206,3 +206,10 @@ } } + +extern "C" { +typedef int externC; // expected-note {{previous declaration is here}} +} +void handleLinkageSpec() { + typedef void externC; // expected-warning {{declaration shadows a typedef in the global namespace}} +}