aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-08-24 18:55:03 +0000
committerDouglas Gregor <dgregor@apple.com>2009-08-24 18:55:03 +0000
commita24eb4ef63d5860a5a02f7532e56e84283782984 (patch)
treea2e330487eb269f7f3b7d9de970bab8fcea177e8
parent504bf55195ccbf84e016a0c7759669dee2975ba3 (diff)
Skip transparent contexts when performing C++ name lookup
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79931 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaLookup.cpp3
-rw-r--r--test/SemaCXX/linkage-spec.cpp8
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index c600f99a40..1d583cc391 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -755,6 +755,9 @@ Sema::CppLookupName(Scope *S, DeclarationName Name,
for (; S; S = S->getParent()) {
DeclContext *Ctx = static_cast<DeclContext *>(S->getEntity());
+ if (Ctx->isTransparentContext())
+ continue;
+
assert(Ctx && Ctx->isFileContext() &&
"We should have been looking only at file context here already.");
diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp
index 864953e9f9..b4c72f557d 100644
--- a/test/SemaCXX/linkage-spec.cpp
+++ b/test/SemaCXX/linkage-spec.cpp
@@ -25,3 +25,11 @@ extern "C" int const bar;
// <rdar://problem/6895431>
extern "C" struct bar d;
extern struct bar e;
+
+extern "C++" {
+ namespace N0 {
+ struct X0 {
+ int foo(int x) { return x; }
+ };
+ }
+} \ No newline at end of file