re PR c++/48313 ([C++0x] std::bind with template function)

PR c++/48313
	* pt.c (maybe_adjust_types_for_deduction): Handle T&& deduction
	from overloaded function.

From-SVN: r171643
This commit is contained in:
Jason Merrill 2011-03-28 20:04:54 -04:00 committed by Jason Merrill
parent 71dae1fe00
commit c2c6f74471
4 changed files with 30 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2011-03-28 Jason Merrill <jason@redhat.com>
PR c++/48313
* pt.c (maybe_adjust_types_for_deduction): Handle T&& deduction
from overloaded function.
Core 1232
* call.c (build_array_conv): New.
(implicit_conversion): Use it.

View File

@ -13936,7 +13936,10 @@ maybe_adjust_types_for_deduction (unification_kind_t strict,
&& TYPE_REF_IS_RVALUE (*parm)
&& TREE_CODE (TREE_TYPE (*parm)) == TEMPLATE_TYPE_PARM
&& cp_type_quals (TREE_TYPE (*parm)) == TYPE_UNQUALIFIED
&& arg_expr && real_lvalue_p (arg_expr))
&& (arg_expr ? real_lvalue_p (arg_expr)
/* try_one_overload doesn't provide an arg_expr, but
functions are always lvalues. */
: TREE_CODE (*arg) == FUNCTION_TYPE))
*arg = build_reference_type (*arg);
/* [temp.deduct.call]

View File

@ -1,3 +1,7 @@
2011-03-28 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/rv-deduce2.C: New.
2011-03-29 Jakub Jelinek <jakub@redhat.com>
PR debug/48203

View File

@ -0,0 +1,18 @@
// PR c++/48313
// { dg-options -std=c++0x }
template<typename F>
void f(F&&) { }
void g() { }
template<typename T> void h() { }
int main()
{
f( g ); // OK
void (&p)() = h<int>;
f( p ); // OK
f( h<int> ); // ???
}