OSDN Git Service

PR c++/35650
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 29 Apr 2008 08:58:20 +0000 (08:58 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 29 Apr 2008 08:58:20 +0000 (08:58 +0000)
* parser.c (cp_parser_lookup_name): Look through single function
OVERLOAD.

* g++.dg/init/ref17.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134788 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/ref17.C [new file with mode: 0644]

index 15aa14c..bb4c4af 100644 (file)
@@ -1,5 +1,9 @@
 2008-04-29  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/35650
+       * parser.c (cp_parser_lookup_name): Look through single function
+       OVERLOAD.
+
        PR c++/35987
        * typeck.c (cp_build_modify_expr) <case PREINCREMENT_EXPR>: Don't build
        COMPOUND_EXPR if the second argument would be error_mark_node.
index 21a762d..a78e124 100644 (file)
@@ -16447,6 +16447,13 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
          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);
        }
index 1154c10..d14a2cc 100644 (file)
@@ -1,5 +1,8 @@
 2008-04-29  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/35650
+       * g++.dg/init/ref17.C: New test.
+
        PR c++/35987
        * g++.dg/other/error28.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/init/ref17.C b/gcc/testsuite/g++.dg/init/ref17.C
new file mode 100644 (file)
index 0000000..2c8c22b
--- /dev/null
@@ -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;
+}