re PR c++/37558 (rev 140120 changes the accessibility of a friend decl.)
authorJason Merrill <jason@redhat.com>
Wed, 17 Sep 2008 17:31:08 +0000 (13:31 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 17 Sep 2008 17:31:08 +0000 (13:31 -0400)
        PR c++/37588
        * name-lookup.c (lookup_type_scope): Look through sk_function_parms.

From-SVN: r140424

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/g++.dg/lookup/friend13.C [new file with mode: 0644]

index 791808d..adad8cc 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-17  Jason Merrill  <jason@redhat.com>
+
+       PR c++/37588
+       * name-lookup.c (lookup_type_scope): Look through sk_function_parms.
+
 2008-09-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/37552
index 743f023..a7c5be4 100644 (file)
@@ -4282,7 +4282,8 @@ lookup_type_scope (tree name, tag_scope scope)
          if (iter->scope == b)
            POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
 
-         if (b->kind == sk_cleanup || b->kind == sk_template_parms)
+         if (b->kind == sk_cleanup || b->kind == sk_template_parms
+             || b->kind == sk_function_parms)
            b = b->level_chain;
          else if (b->kind == sk_class
                   && scope == ts_within_enclosing_non_class)
diff --git a/gcc/testsuite/g++.dg/lookup/friend13.C b/gcc/testsuite/g++.dg/lookup/friend13.C
new file mode 100644 (file)
index 0000000..bec71df
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/37558
+
+class Foo {
+ friend class Bar;
+ friend void func(const class Bar*);
+};