aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-05-05 18:24:05 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-05-05 18:24:05 +0000
commitb98cf79a3add5c80b40a956a4cd3d9b3a23b9b22 (patch)
treef09d2b781ebb1af84fc26fcd70d18f89415ac576
parent30ae1ed71dc99a396b7ddba9cabe9846a0c4449d (diff)
Use lexical contexts when checking for conflicting language linkages.
This fixes pr14958. I will audit other calls to isExternCContext to see if there are any similar bugs left. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181163 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDecl.cpp4
-rw-r--r--test/SemaCXX/linkage-spec.cpp8
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 7b332f9fda..b5e2c6ebe8 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2247,10 +2247,10 @@ static bool haveIncompatibleLanguageLinkages(const T *Old, const T *New) {
LanguageLinkage OldLinkage = Old->getLanguageLinkage();
if (OldLinkage == CXXLanguageLinkage &&
- New->getDeclContext()->isExternCContext())
+ New->getLexicalDeclContext()->isExternCContext())
return true;
if (OldLinkage == CLanguageLinkage &&
- New->getDeclContext()->isExternCXXContext())
+ New->getLexicalDeclContext()->isExternCXXContext())
return true;
return false;
}
diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp
index 0ba9508124..504df0d35c 100644
--- a/test/SemaCXX/linkage-spec.cpp
+++ b/test/SemaCXX/linkage-spec.cpp
@@ -106,3 +106,11 @@ namespace PR9162 {
return sizeof(ArtsSink);
}
}
+
+namespace pr14958 {
+ namespace js { extern int ObjectClass; }
+ extern "C" {
+ namespace js {}
+ }
+ int js::ObjectClass;
+}