static tree
cxx_eval_logical_expression (const constexpr_ctx *ctx, tree t,
tree bailout_value, tree continue_value,
- bool lval,
- bool *non_constant_p, bool *overflow_p)
+ bool, bool *non_constant_p, bool *overflow_p)
{
tree r;
tree lhs = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
- lval,
- non_constant_p, overflow_p);
+ /*lval*/false, non_constant_p,
+ overflow_p);
VERIFY_CONSTANT (lhs);
if (tree_int_cst_equal (lhs, bailout_value))
return lhs;
gcc_assert (tree_int_cst_equal (lhs, continue_value));
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1),
- lval, non_constant_p,
+ /*lval*/false, non_constant_p,
overflow_p);
VERIFY_CONSTANT (r);
return r;
--- /dev/null
+// PR c++/105321
+// { dg-do compile { target c++11 } }
+
+bool handle_error();
+
+constexpr int echo(int value, bool yes = true) noexcept
+{
+ return (yes || handle_error()), value;
+}
+
+static_assert(echo(10) == 10, "");
+
+constexpr int echo2(int value, bool no = false) noexcept
+{
+ return (!no || handle_error()), value;
+}
+
+static_assert(echo2(10) == 10, "");