2009-10-08 Jason Merrill <jason@redhat.com>
+ PR c++/36816
+ * pt.c (maybe_adjust_types_for_deduction): Do rvalue ref adjustment
+ even when DEDUCE_EXACT.
+
PR c++/37177
* pt.c (resolve_nondeduced_context): New.
* cvt.c (convert_to_void): Call it.
}
case DEDUCE_EXACT:
- /* There is nothing to do in this case. */
+ /* Core issue #873: Do the DR606 thing (see below) for these cases,
+ too, but here handle it by stripping the reference from PARM
+ rather than by adding it to ARG. */
+ if (TREE_CODE (*parm) == REFERENCE_TYPE
+ && TYPE_REF_IS_RVALUE (*parm)
+ && TREE_CODE (TREE_TYPE (*parm)) == TEMPLATE_TYPE_PARM
+ && cp_type_quals (TREE_TYPE (*parm)) == TYPE_UNQUALIFIED
+ && TREE_CODE (*arg) == REFERENCE_TYPE
+ && !TYPE_REF_IS_RVALUE (*arg))
+ *parm = TREE_TYPE (*parm);
+ /* Nothing else to do in this case. */
return 0;
default:
2009-10-08 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/rv-deduce.C: New.
+
PR c++/37177
* g++.dg/cpp0x/variadic-throw.C: Adjust errors.
* g++.dg/template/explicit-args2.C: New.
--- /dev/null
+// PR c++/36816, core issue 873
+// { dg-options -std=c++0x }
+
+template <class T> void h (T&&) { }
+
+void (*pf)(int&) = &h;
+template <> void h(char&);
+template void h(double&);