+2009-11-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/42013
+ * call.c (build_conditional_expr): Check specifically for folding
+ to CALL_EXPR rather than TREE_SIDE_EFFECTS.
+
2009-11-12 Jason Merrill <jason@redhat.com>
* typeck.c (cv_qualified_p): New fn.
tree arg2_type;
tree arg3_type;
tree result = NULL_TREE;
+ tree result_save;
tree result_type = NULL_TREE;
bool lvalue_p = true;
struct z_candidate *candidates = 0;
}
valid_operands:
- result = build3 (COND_EXPR, result_type, arg1, arg2, arg3);
+ result_save = build3 (COND_EXPR, result_type, arg1, arg2, arg3);
+ result = fold_if_not_in_template (result_save);
- if (cp_unevaluated_operand && TREE_SIDE_EFFECTS (result))
- /* Avoid folding a ?: of two calls within decltype (c++/42013). */;
- else
- result = fold_if_not_in_template (result);
+ if (cp_unevaluated_operand && TREE_CODE (result) == CALL_EXPR)
+ /* Avoid folding to a CALL_EXPR within decltype (c++/42013). */
+ result = result_save;
/* We can't use result_type below, as fold might have returned a
throw_expr. */