2006-06-15 Mark Mitchell <mark@codesourcery.com>
+ PR c++/27666
+ * call.c (build_conditional_expr): Robustify.
+
PR c++/27640
* pt.c (instantiate_template): Set processing_template_decl to
zero while performing substitutions.
arg2 = convert_like (conv2, arg2);
arg2 = convert_from_reference (arg2);
arg2_type = TREE_TYPE (arg2);
+ /* Even if CONV2 is a valid conversion, the result of the
+ conversion may be invalid. For example, if ARG3 has type
+ "volatile X", and X does not have a copy constructor
+ accepting a "volatile X&", then even if ARG2 can be
+ converted to X, the conversion will fail. */
+ if (error_operand_p (arg2))
+ result = error_mark_node;
}
else if (conv3 && (!conv3->bad_p || !conv2))
{
arg3 = convert_like (conv3, arg3);
arg3 = convert_from_reference (arg3);
arg3_type = TREE_TYPE (arg3);
+ if (error_operand_p (arg3))
+ result = error_mark_node;
}
/* Free all the conversions we allocated. */
--- /dev/null
+// PR c++/27666
+
+struct A { // { dg-error "A" }
+ A(int); // { dg-error "A" }
+};
+
+void foo(volatile A a) {
+ 1 ? a : 0; // { dg-error "match|temporary" }
+ 1 ? 0 : a; // { dg-error "match|temporary" }
+}