From cbcbdb5418545f88fd21f6524705b078e78f5dcb Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 19 Apr 2016 13:40:03 +0000 Subject: [PATCH] PR c++/70522 * name-lookup.c (qualified_lookup_using_namespace): Look through hidden names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235206 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/name-lookup.c | 3 ++- gcc/testsuite/g++.dg/lookup/friend18.C | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/lookup/friend18.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c50c6abd616..056e91740c0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-04-19 Jason Merrill + + PR c++/70522 + * name-lookup.c (qualified_lookup_using_namespace): Look through + hidden names. + 2016-04-18 Michael Matz * class.c (build_vtable): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 89d84d7b1c3..b3828c0956b 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -4647,8 +4647,9 @@ qualified_lookup_using_namespace (tree name, tree scope, cp_binding_level_find_binding_for_name (NAMESPACE_LEVEL (scope), name); if (binding) { - found_here = true; ambiguous_decl (result, binding, flags); + if (result->type || result->value) + found_here = true; } for (usings = DECL_NAMESPACE_USING (scope); usings; diff --git a/gcc/testsuite/g++.dg/lookup/friend18.C b/gcc/testsuite/g++.dg/lookup/friend18.C new file mode 100644 index 00000000000..90cd2d75dc7 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/friend18.C @@ -0,0 +1,15 @@ +// PR c++/70522 + +namespace A { + struct C { + friend void i(); + }; + namespace { + int i; + } +} + +int main() +{ + return A::i; +} -- 2.11.4.GIT