diff options
Diffstat (limited to 'gcc/cp/constexpr.c')
-rw-r--r-- | gcc/cp/constexpr.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index d89bdd5a6a4..47ff90cb055 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -1763,7 +1763,13 @@ reduced_constant_expression_p (tree t) /* And we need to handle PTRMEM_CST wrapped in a CONSTRUCTOR. */ tree idx, val, field; unsigned HOST_WIDE_INT i; if (CONSTRUCTOR_NO_IMPLICIT_ZERO (t)) - field = next_initializable_field (TYPE_FIELDS (TREE_TYPE (t))); + { + if (TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) + /* An initialized vector would have a VECTOR_CST. */ + return false; + else + field = next_initializable_field (TYPE_FIELDS (TREE_TYPE (t))); + } else field = NULL_TREE; FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), i, idx, val) @@ -4254,7 +4260,16 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0), lval, non_constant_p, overflow_p); - *jump_target = t; + if (jump_target) + *jump_target = t; + else + { + /* Can happen with ({ return true; }) && false; passed to + maybe_constant_value. There is nothing to jump over in this + case, and the bug will be diagnosed later. */ + gcc_assert (ctx->quiet); + *non_constant_p = true; + } break; case SAVE_EXPR: @@ -4726,6 +4741,10 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, jump_target); break; + case USING_STMT: + r = void_node; + break; + default: if (STATEMENT_CODE_P (TREE_CODE (t))) { @@ -5591,6 +5610,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, case OMP_PARALLEL: case OMP_TASK: case OMP_FOR: + case OMP_SIMD: case OMP_DISTRIBUTE: case OMP_TASKLOOP: case OMP_TEAMS: |