+1999-08-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_conditional_expr): Fix typo.
+ * typeck.c (build_modify_expr, COND_EXPR): Make sure we've got an
+ lvalue before trying to mess with the sides.
+
+ * error.c (dump_expr, CONVERT_EXPR): Handle (void) properly.
+
Mon Aug 23 22:17:20 1999 Mumit Khan <khan@xraylith.wisc.edu>
* g++spec.c (lang_specific_driver): Add room for NULL in arglist.
if ((TREE_CODE (arg2) == THROW_EXPR)
^ (TREE_CODE (arg3) == THROW_EXPR))
result_type = ((TREE_CODE (arg2) == THROW_EXPR)
- ? arg2_type : arg3_type);
+ ? arg3_type : arg2_type);
else if (arg2_void_p && arg3_void_p)
result_type = void_type_node;
else
break;
case CONVERT_EXPR:
- dump_unary_op ("+", t, nop);
+ if (same_type_p (TREE_TYPE (t), void_type_node))
+ {
+ OB_PUTS ("(void)");
+ dump_expr (TREE_OPERAND (t, 0), 0);
+ }
+ else
+ dump_unary_op ("+", t, nop);
break;
case ADDR_EXPR:
/* Produce (a ? (b = rhs) : (c = rhs))
except that the RHS goes through a save-expr
so the code to compute it is only emitted once. */
- tree cond
- = build_conditional_expr (TREE_OPERAND (lhs, 0),
- build_modify_expr (cp_convert (TREE_TYPE (lhs), TREE_OPERAND (lhs, 1)),
- modifycode, rhs),
- build_modify_expr (cp_convert (TREE_TYPE (lhs), TREE_OPERAND (lhs, 2)),
- modifycode, rhs));
+ tree cond;
+
+ /* Check this here to avoid odd errors when trying to convert
+ a throw to the type of the COND_EXPR. */
+ if (!lvalue_or_else (lhs, "assignment"))
+ return error_mark_node;
+
+ cond = build_conditional_expr
+ (TREE_OPERAND (lhs, 0),
+ build_modify_expr (cp_convert (TREE_TYPE (lhs),
+ TREE_OPERAND (lhs, 1)),
+ modifycode, rhs),
+ build_modify_expr (cp_convert (TREE_TYPE (lhs),
+ TREE_OPERAND (lhs, 2)),
+ modifycode, rhs));
+
if (cond == error_mark_node)
return cond;
/* Make sure the code to compute the rhs comes out