summaryrefslogtreecommitdiff
path: root/gcc/cp/constexpr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/constexpr.c')
-rw-r--r--gcc/cp/constexpr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index f75f0b039fa..e8c7702dede 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -3770,7 +3770,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
return (*ctx->values->get (t));
case VAR_DECL:
- if (is_capture_proxy (t))
+ if (DECL_HAS_VALUE_EXPR_P (t))
return cxx_eval_constant_expression (ctx, DECL_VALUE_EXPR (t),
lval, non_constant_p, overflow_p);
/* fall through */
@@ -5037,6 +5037,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
return RECUR (TREE_OPERAND (t, 0), rval);
case VAR_DECL:
+ if (DECL_HAS_VALUE_EXPR_P (t))
+ return RECUR (DECL_VALUE_EXPR (t), rval);
if (want_rval
&& !var_in_maybe_constexpr_fn (t)
&& !type_dependent_expression_p (t)
@@ -5105,6 +5107,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
#endif
return RECUR (t, any);
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
case COMPONENT_REF:
case BIT_FIELD_REF:
case ARROW_EXPR:
@@ -5276,8 +5280,6 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
return true;
/* fall through. */
- case REALPART_EXPR:
- case IMAGPART_EXPR:
case CONJ_EXPR:
case SAVE_EXPR:
case FIX_TRUNC_EXPR: