PR c++/48313
* pt.c (maybe_adjust_types_for_deduction): Handle T&& deduction
from overloaded function.
From-SVN: r171643
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.
&& 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]
+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
--- /dev/null
+// 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> ); // ???
+}
+