re PR c++/35650 (Can't bind ref-to-function through using-decl. in namespace)

PR c++/35650
	* parser.c (cp_parser_lookup_name): Look through single function
	OVERLOAD.

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

From-SVN: r134788
This commit is contained in:
Jakub Jelinek 2008-04-29 10:58:20 +02:00 committed by Jakub Jelinek
parent f2be060fd3
commit 58627576a4
4 changed files with 37 additions and 0 deletions

View 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.

View 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);
}

View 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.

View File

@ -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;
}