From: Richard Smith Date: Fri, 12 Jun 2015 01:32:13 +0000 (+0000) Subject: [modules] Apply name visibility rules to names found by ADL. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70119b2993d7474d4db224b5f61120e9333c7e4c;p=clang [modules] Apply name visibility rules to names found by ADL. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239578 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 147b81bc59..202f027f6f 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -3032,6 +3032,9 @@ void Sema::ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, if (!isa(D) && !isa(D)) continue; + if (!isVisible(D) && !(D = findAcceptableDecl(*this, D))) + continue; + Result.insert(D); } } diff --git a/test/Modules/Inputs/submodules-merge-defs/defs.h b/test/Modules/Inputs/submodules-merge-defs/defs.h index 44259463a1..ad3711f073 100644 --- a/test/Modules/Inputs/submodules-merge-defs/defs.h +++ b/test/Modules/Inputs/submodules-merge-defs/defs.h @@ -55,3 +55,9 @@ namespace NS { template<> struct B : B {}; inline void f() {} } + +namespace StaticInline { + struct X {}; + static inline void f(X); + static inline void g(X x) { f(x); } +} diff --git a/test/Modules/submodules-merge-defs.cpp b/test/Modules/submodules-merge-defs.cpp index e7c0ad7f0c..e942335151 100644 --- a/test/Modules/submodules-merge-defs.cpp +++ b/test/Modules/submodules-merge-defs.cpp @@ -13,8 +13,8 @@ A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}} // expected-note@defs.h:1 +{{here}} -// FIXME: We should warn that use_a is being used without being imported. -int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} +// expected-note@defs.h:2 +{{here}} +int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} expected-error {{'use_a' must be imported}} B::Inner2 pre_bi; // expected-error +{{must be imported}} // expected-note@defs.h:4 +{{here}}