diff options
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 58bca7a82f6..4d34a4cc4dd 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3297,12 +3297,21 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3) 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. */ |