aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-04-19 09:40:03 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-04-19 09:40:03 -0400
commit3ba065e89ed92e76d5a1941b786111fbc1c70fa7 (patch)
tree2a1ed2d29ebae5af4871ef305903eed37779c353 /gcc
parenta01769033508b575d055d31bfd4adc370e20e448 (diff)
downloadgcc-3ba065e89ed92e76d5a1941b786111fbc1c70fa7.zip
gcc-3ba065e89ed92e76d5a1941b786111fbc1c70fa7.tar.gz
gcc-3ba065e89ed92e76d5a1941b786111fbc1c70fa7.tar.bz2
re PR c++/70522 (Hidden friend functions block qualified name lookup into nested unnamed namespace)
PR c++/70522 * name-lookup.c (qualified_lookup_using_namespace): Look through hidden names. From-SVN: r235206
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c3
-rw-r--r--gcc/testsuite/g++.dg/lookup/friend18.C15
3 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c50c6ab..056e917 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-04-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/70522
+ * name-lookup.c (qualified_lookup_using_namespace): Look through
+ hidden names.
+
2016-04-18 Michael Matz <matz@suse.de>
* 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 89d84d7..b3828c0 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 0000000..90cd2d7
--- /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;
+}