tree.c (build_vec_init_expr): Take complain parm.
* 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
This commit is contained in:
parent
b73a470455
commit
9c69dcea0d
@ -1,5 +1,13 @@
|
||||
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.
|
||||
|
@ -2896,8 +2896,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
|
||||
(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. */
|
||||
@ -5420,7 +5420,7 @@ extern tree get_target_expr_sfinae (tree, tsubst_flags_t);
|
||||
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);
|
||||
|
@ -506,7 +506,7 @@ perform_member_init (tree member, tree init)
|
||||
/* 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);
|
||||
}
|
||||
@ -543,7 +543,7 @@ perform_member_init (tree member, tree 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);
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ build_cplus_new (tree type, tree init, tsubst_flags_t complain)
|
||||
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;
|
||||
@ -485,7 +485,7 @@ build_vec_init_elt (tree type, tree init)
|
||||
/* 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
|
||||
@ -499,9 +499,12 @@ build_vec_init_elt (tree type, tree init)
|
||||
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
|
||||
@ -509,11 +512,11 @@ build_vec_init_elt (tree type, tree init)
|
||||
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)
|
||||
{
|
||||
@ -550,14 +553,14 @@ diagnose_non_constexpr_vec_init (tree expr)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user