diff options
author | Jason Merrill <jason@redhat.com> | 2019-04-04 22:52:23 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-04-04 22:52:23 -0400 |
commit | ce36ba09fe2c1b8523265e217f8cb478f50607c3 (patch) | |
tree | de66712d85a783797871566058cfc25a93b551b7 /gcc/cp/constexpr.c | |
parent | 950b198d4a3225cbec2d3408b947bf48057c5762 (diff) | |
download | gcc-ce36ba09fe2c1b8523265e217f8cb478f50607c3.zip gcc-ce36ba09fe2c1b8523265e217f8cb478f50607c3.tar.gz gcc-ce36ba09fe2c1b8523265e217f8cb478f50607c3.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/constexpr.c')
-rw-r--r-- | gcc/cp/constexpr.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 53854a8..0ce5618 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -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; } |