diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-08 15:38:36 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-08 15:38:36 +0000 |
commit | 1237259bda343504cc0bd3cfe2198bdeea2b2fdf (patch) | |
tree | 2ed7b8d2121610d1d156ba5d1dc088c094960449 /lib/Sema/SemaLookup.cpp | |
parent | 155fd79b3a6dd25fbac1716fa3f8148de1e53c49 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 1ddfef839f..48d7320d2e 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -480,7 +480,12 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) { 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. |