* tree.c (build_vec_init_expr): Take complain parm.
(build_vec_init_elt): Likewise. Free arg vector.
(diagnose_non_constexpr_vec_init, build_array_copy): Adjust.
* cp-tree.h (VEC_INIT_EXPR_SLOT): Use VEC_INIT_EXPR_CHECK.
(VEC_INIT_EXPR_INIT): Likewise.
Adjust build_vec_init_expr declaration.
* init.c (perform_member_init): Adjust.
From-SVN: r173275
2011-05-02 Jason Merrill <jason@redhat.com>
+ * tree.c (build_vec_init_expr): Take complain parm.
+ (build_vec_init_elt): Likewise. Free arg vector.
+ (diagnose_non_constexpr_vec_init, build_array_copy): Adjust.
+ * cp-tree.h (VEC_INIT_EXPR_SLOT): Use VEC_INIT_EXPR_CHECK.
+ (VEC_INIT_EXPR_INIT): Likewise.
+ Adjust build_vec_init_expr declaration.
+ * init.c (perform_member_init): Adjust.
+
Revert:
PR c++/40975
* cp-tree.def (VEC_INIT_EXPR): Add third operand.
(arg) = next_aggr_init_expr_arg (&(iter)))
/* VEC_INIT_EXPR accessors. */
-#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (NODE, 0)
-#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (NODE, 1)
+#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 0)
+#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 1)
/* Indicates that a VEC_INIT_EXPR is a potential constant expression.
Only set when the current function is constexpr. */
extern tree build_cplus_array_type (tree, tree);
extern tree build_array_of_n_type (tree, int);
extern tree build_array_copy (tree);
-extern tree build_vec_init_expr (tree, tree);
+extern tree build_vec_init_expr (tree, tree, tsubst_flags_t);
extern void diagnose_non_constexpr_vec_init (tree);
extern tree hash_tree_cons (tree, tree, tree);
extern tree hash_tree_chain (tree, tree);
/* mem() means value-initialization. */
if (TREE_CODE (type) == ARRAY_TYPE)
{
- init = build_vec_init_expr (type, init);
+ init = build_vec_init_expr (type, init, tf_warning_or_error);
init = build2 (INIT_EXPR, type, decl, init);
finish_expr_stmt (init);
}
|| same_type_ignoring_top_level_qualifiers_p (type,
TREE_TYPE (init)))
{
- init = build_vec_init_expr (type, init);
+ init = build_vec_init_expr (type, init, tf_warning_or_error);
init = build2 (INIT_EXPR, type, decl, init);
finish_expr_stmt (init);
}
another array to copy. */
static tree
-build_vec_init_elt (tree type, tree init)
+build_vec_init_elt (tree type, tree init, tsubst_flags_t complain)
{
tree inner_type = strip_array_types (type);
VEC(tree,gc) *argvec;
/* No interesting initialization to do. */
return integer_zero_node;
else if (init == void_type_node)
- return build_value_init (inner_type, tf_warning_or_error);
+ return build_value_init (inner_type, complain);
gcc_assert (init == NULL_TREE
|| (same_type_ignoring_top_level_qualifiers_p
dummy = move (dummy);
VEC_quick_push (tree, argvec, dummy);
}
- return build_special_member_call (NULL_TREE, complete_ctor_identifier,
+ init = build_special_member_call (NULL_TREE, complete_ctor_identifier,
&argvec, inner_type, LOOKUP_NORMAL,
- tf_warning_or_error);
+ complain);
+ release_tree_vector (argvec);
+
+ return init;
}
/* Return a TARGET_EXPR which expresses the initialization of an array to
from another array of the same type. */
tree
-build_vec_init_expr (tree type, tree init)
+build_vec_init_expr (tree type, tree init, tsubst_flags_t complain)
{
tree slot;
bool value_init = false;
- tree elt_init = build_vec_init_elt (type, init);
+ tree elt_init = build_vec_init_elt (type, init, complain);
if (init == void_type_node)
{
else
init = VEC_INIT_EXPR_INIT (expr);
- elt_init = build_vec_init_elt (type, init);
+ elt_init = build_vec_init_elt (type, init, tf_warning_or_error);
require_potential_constant_expression (elt_init);
}
tree
build_array_copy (tree init)
{
- return build_vec_init_expr (TREE_TYPE (init), init);
+ return build_vec_init_expr (TREE_TYPE (init), init, tf_warning_or_error);
}
/* Build a TARGET_EXPR using INIT to initialize a new temporary of the