summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-03-12 16:45:13 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-03-12 16:45:13 +0000
commitcfd2528a46a8b054c735d1485fde12e3b99fa0d7 (patch)
tree54046a25353978b0425839652d834cd55435f22a /clang/lib/Sema/SemaDecl.cpp
parenta5151271e67584aa7563de49614bd3bc7bc3d1ff (diff)
downloadbcm5719-llvm-cfd2528a46a8b054c735d1485fde12e3b99fa0d7.tar.gz
bcm5719-llvm-cfd2528a46a8b054c735d1485fde12e3b99fa0d7.zip
We already reported an error for
extern "C" { void test5_f() { extern int test5_b; } } static float test5_b; This patch makes us report one for extern "C" { void test6_f() { extern int test6_b; } } extern "C" { static float test6_b; } Not because we think the declaration would be extern C, but because of the rule: An entity with C language linkage shall not be declared with the same name as an entity in global scope... We were just not looking past the extern "C" to see if the decl was in global scope. llvm-svn: 176875
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 252f94dc226..659d9638f47 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5004,7 +5004,8 @@ void Sema::CheckShadow(Scope *S, VarDecl *D) {
template<typename T>
static bool mayConflictWithNonVisibleExternC(const T *ND) {
- return ND->isExternC() || ND->getDeclContext()->isTranslationUnit();
+ return ND->isExternC() ||
+ ND->getDeclContext()->getRedeclContext()->isTranslationUnit();
}
/// \brief Perform semantic checking on a newly-created variable
OpenPOWER on IntegriCloud