2014-05-09 Jason Merrill <jason@redhat.com>
+ PR c++/54348
+ * call.c (build_conditional_expr_1): If overload resolution finds
+ no match, just say "different types".
+
+ PR c++/32019
+ * call.c (build_conditional_expr_1): Improve ambiguity diagnostic.
+
PR c++/22434
* call.c (build_conditional_expr_1): Don't try to pool cv-quals
if we didn't find a conversion.
|| (conv3 && conv3->kind == ck_ambig))
{
if (complain & tf_error)
- error_at (loc, "operands to ?: have different types %qT and %qT",
- arg2_type, arg3_type);
+ {
+ error_at (loc, "operands to ?: have different types %qT and %qT",
+ arg2_type, arg3_type);
+ if (conv2 && !conv2->bad_p && conv3 && !conv3->bad_p)
+ inform (loc, " and each type can be converted to the other");
+ else if (conv2 && conv2->kind == ck_ambig)
+ convert_like (conv2, arg2, complain);
+ else
+ convert_like (conv3, arg3, complain);
+ }
result = error_mark_node;
}
else if (conv2 && !conv2->bad_p)
if (!any_viable_p)
{
if (complain & tf_error)
- {
- op_error (loc, COND_EXPR, NOP_EXPR, arg1, arg2, arg3, FALSE);
- print_z_candidates (loc, candidates);
- }
+ error_at (loc, "operands to ?: have different types %qT and %qT",
+ arg2_type, arg3_type);
return error_mark_node;
}
cand = tourney (candidates, complain);
f(a); // { dg-error "" }
B b2 = { a }; // { dg-error "" }
a + true; // { dg-error "5:no match" }
- b ? a : true; // { dg-error "5:no match" }
- a ? a : true; // { dg-error "5:no match" }
+ b ? a : true; // { dg-error "5:?:" }
+ a ? a : true; // { dg-error "5:?:" }
}