return potential_constant_expression_1 (t, false, true, true, tf_none);
}
+/* As above, but expect an rvalue. */
+
+bool
+is_rvalue_constant_expression (tree t)
+{
+ return potential_constant_expression_1 (t, true, true, true, tf_none);
+}
+
/* Like above, but complain about non-constant expressions. */
bool
extern tree ensure_literal_type_for_constexpr_object (tree);
extern bool potential_constant_expression (tree);
extern bool is_constant_expression (tree);
+extern bool is_rvalue_constant_expression (tree);
extern bool is_nondependent_constant_expression (tree);
extern bool is_nondependent_static_init_expression (tree);
extern bool is_static_init_expression (tree);
init = boolean_true_node;
}
else if (init
- && init_const_expr_p
+ && (init_const_expr_p || DECL_DECLARED_CONSTEXPR_P (decl))
&& !TYPE_REF_P (type)
&& decl_maybe_constant_var_p (decl)
&& !(dep_init = value_dependent_init_p (init)))
if (TREE_TYPE (expression)
&& TREE_CODE (TREE_TYPE (expression)) == ARRAY_TYPE)
decay = build_address (expression);
- bool is_const = potential_rvalue_constant_expression (decay);
+ bool is_const = is_rvalue_constant_expression (decay);
parser->non_integral_constant_expression_p = !is_const;
if (!is_const && !allow_non_constant_p)
- require_potential_rvalue_constant_expression (decay);
+ require_rvalue_constant_expression (decay);
}
if (allow_non_constant_p)
*non_constant_p = parser->non_integral_constant_expression_p;