Commit ce36ba09 by Jason Merrill Committed by Jason Merrill

PR c++/89948 - ICE with break in statement-expr.

	* constexpr.c (cxx_eval_statement_list): Jumping out of a
	statement-expr is non-constant.

From-SVN: r270161
parent 950b198d
2019-04-04 Jason Merrill <jason@redhat.com>
PR c++/89948 - ICE with break in statement-expr.
* constexpr.c (cxx_eval_statement_list): Jumping out of a
statement-expr is non-constant.
2019-04-04 Jason Merrill <jason@redhat.com>
PR c++/89966 - error with non-type auto tparm.
* pt.c (do_auto_deduction): Clear tf_partial.
......
......@@ -4153,6 +4153,15 @@ cxx_eval_statement_list (const constexpr_ctx *ctx, tree t,
if (returns (jump_target) || breaks (jump_target))
break;
}
if (*jump_target && jump_target == &local_target)
{
/* We aren't communicating the jump to our caller, so give up. We don't
need to support evaluation of jumps out of statement-exprs. */
if (!ctx->quiet)
error_at (cp_expr_loc_or_loc (r, input_location),
"statement is not a constant expression");
*non_constant_p = true;
}
return r;
}
......
// PR c++/89948
// { dg-options "" }
void f ()
{
int a = 0;
for (;;)
for (;a=+({break;1;});)
{}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment