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
This commit is contained in:
parent
950b198d4a
commit
ce36ba09fe
3 changed files with 25 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
10
gcc/testsuite/g++.dg/ext/stmtexpr23.C
Normal file
10
gcc/testsuite/g++.dg/ext/stmtexpr23.C
Normal file
|
@ -0,0 +1,10 @@
|
|||
// PR c++/89948
|
||||
// { dg-options "" }
|
||||
|
||||
void f ()
|
||||
{
|
||||
int a = 0;
|
||||
for (;;)
|
||||
for (;a=+({break;1;});)
|
||||
{}
|
||||
}
|
Loading…
Add table
Reference in a new issue