When performing unqualified name lookup in C++, don't look directly
into transparent contexts; instead, we'll look into their nearest
enclosing non-transparent contexts further up the stack. Fixes PR5479.
llvm-svn: 90859
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 1ddfef8..48d7320 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -480,7 +480,12 @@
DeclContext *OuterCtx = findOuterContext(S);
for (; Ctx && Ctx->getPrimaryContext() != OuterCtx;
Ctx = Ctx->getLookupParent()) {
- if (Ctx->isFunctionOrMethod())
+ // We do not directly look into function or method contexts
+ // (since all local variables are found via the identifier
+ // changes) or in transparent contexts (since those entities
+ // will be found in the nearest enclosing non-transparent
+ // context).
+ if (Ctx->isFunctionOrMethod() || Ctx->isTransparentContext())
continue;
// Perform qualified name lookup into this context.