+2013-03-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/56095
+ * class.c (resolve_address_of_overloaded_function): Accept a
+ reference to function for target_type.
+ (instantiate_type): Likewise.
+ * pt.c (convert_nontype_argument): Pass it to
+ convert_nontype_argument_function.
+
2013-03-16 Jakub Jelinek <jakub@redhat.com>
* tree.c (cp_tree_equal): Fix a pasto.
gcc_assert (is_overloaded_fn (overload));
/* Check that the TARGET_TYPE is reasonable. */
- if (TYPE_PTRFN_P (target_type))
+ if (TYPE_PTRFN_P (target_type)
+ || TYPE_REFFN_P (target_type))
/* This is OK. */;
else if (TYPE_PTRMEMFUNC_P (target_type))
/* This is OK, too. */
if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs)))
{
- if (same_type_p (lhstype, TREE_TYPE (rhs)))
+ tree fntype = non_reference (lhstype);
+ if (same_type_p (fntype, TREE_TYPE (rhs)))
return rhs;
if (flag_ms_extensions
- && TYPE_PTRMEMFUNC_P (lhstype)
+ && TYPE_PTRMEMFUNC_P (fntype)
&& !TYPE_PTRMEMFUNC_P (TREE_TYPE (rhs)))
/* Microsoft allows `A::f' to be resolved to a
pointer-to-member. */
{
if (flags & tf_error)
error ("cannot convert %qE from type %qT to type %qT",
- rhs, TREE_TYPE (rhs), lhstype);
+ rhs, TREE_TYPE (rhs), fntype);
return error_mark_node;
}
}
return NULL_TREE;
}
- expr = convert_nontype_argument_function (TREE_TYPE (type), expr);
+ expr = convert_nontype_argument_function (type, expr);
if (!expr || expr == error_mark_node)
return expr;