@@ -15708,29 +15708,28 @@ of a subscript operation).
1570815708 operand_2->variant.constant.folded_statement_expression;
1570915709 } /* if */
1571015710 } /* if */
15711- } else if (op == eok_lor && constexpr_enabled &&
15711+ } else if (( op == eok_lor || op == eok_land) && constexpr_enabled &&
1571215712 !expr_stack->possible_rescan_context &&
1571315713 is_constant_operand(operand_1) &&
1571415714 constant_bool_value_known_at_compile_time(
1571515715 &operand_1->variant.constant) &&
15716- !op_is_false_constant(operand_1)) {
15717- /* (1 || nonconstant) produces true in C++11. */
15718- eliminate_stmt_expr_refs_if_operand_dropped(operand_2);
15719- discard_operand(operand_2);
15720- make_integer_constant_operand(result, (a_host_large_integer)1);
15721- cast_operand(result_type, result, /*is_implicit_cast=*/TRUE);
15722- did_not_fold = FALSE;
15723- } else if (op == eok_land && constexpr_enabled &&
15724- !expr_stack->possible_rescan_context &&
15725- is_constant_operand(operand_1) &&
15726- constant_bool_value_known_at_compile_time(
15727- &operand_1->variant.constant) &&
15728- op_is_false_constant(operand_1)) {
15729- /* (0 && nonconstant) produces false in C++11. */
15730- eliminate_stmt_expr_refs_if_operand_dropped(operand_2);
15716+ op_is_false_constant(operand_1) == (op == eok_land)) {
15717+ /* The left operand determines the value of the operation. Preserve
15718+ statement-expression entries if the right operand will appear in
15719+ the backing expression. */
15720+ a_boolean record_backing_expr =
15721+ curr_expr_kind_is_one_in_which_const_exprs_are_recorded();
15722+ if (!record_backing_expr) {
15723+ eliminate_stmt_expr_refs_if_operand_dropped(operand_2);
15724+ } /* if */
1573115725 discard_operand(operand_2);
15732- make_integer_constant_operand(result, (a_host_large_integer)0);
15726+ make_integer_constant_operand(result,
15727+ (a_host_large_integer)(op == eok_lor));
1573315728 cast_operand(result_type, result, /*is_implicit_cast=*/TRUE);
15729+ if (record_backing_expr) {
15730+ result->variant.constant.folded_statement_expression =
15731+ expr_stack->statement_expression_seen;
15732+ } /* if */
1573415733 did_not_fold = FALSE;
1573515734#if GNU_EXTENSIONS_ALLOWED
1573615735 } else if ((op == eok_pdiff || op == eok_eq || op == eok_ne) &&
0 commit comments