gcc/gcc43-pr35650.patch

51 lines
1.1 KiB
Diff

2008-04-21 Jakub Jelinek <jakub@redhat.com>
PR c++/35650
* parser.c (cp_parser_lookup_name): Look through single function
OVERLOAD.
* g++.dg/init/ref17.C: New test.
--- gcc/cp/parser.c.jj 2008-04-18 17:00:44.000000000 +0200
+++ gcc/cp/parser.c 2008-04-21 23:58:00.000000000 +0200
@@ -16407,6 +16407,13 @@ cp_parser_lookup_name (cp_parser *parser
decl = lookup_qualified_name (parser->scope, name,
tag_type != none_type,
/*complain=*/true);
+
+ /* If we have a single function from a using decl, pull it out. */
+ if (decl
+ && TREE_CODE (decl) == OVERLOAD
+ && !really_overloaded_fn (decl))
+ decl = OVL_FUNCTION (decl);
+
if (pushed_scope)
pop_scope (pushed_scope);
}
--- gcc/testsuite/g++.dg/init/ref17.C.jj 2008-04-21 22:48:02.000000000 +0200
+++ gcc/testsuite/g++.dg/init/ref17.C 2008-04-21 22:47:09.000000000 +0200
@@ -0,0 +1,23 @@
+// PR c++/35650
+// { dg-do compile }
+
+void f1 ();
+
+namespace N
+{
+ using::f1;
+ void f2 ();
+ void f3 ();
+}
+
+using N::f3;
+
+void
+test ()
+{
+ void (&a) () = f1;
+ void (&b) () = N::f1;
+ void (&c) () = N::f2;
+ void (&d) () = f3;
+ void (&e) () = ::f3;
+}