diff options
author | Jason Merrill <jason@redhat.com> | 2011-04-27 21:53:34 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-04-27 21:53:34 -0400 |
commit | c12ff9d8f0f20cd2de63de6f14b9f0330e7ceb66 (patch) | |
tree | 7fc7f017ff214e07e3790efe9c01bfe2b4b52bdb /gcc/cp/init.c | |
parent | fbaf0d0c082815cf67d958b7c9f596b1f814eca0 (diff) | |
download | gcc-c12ff9d8f0f20cd2de63de6f14b9f0330e7ceb66.zip gcc-c12ff9d8f0f20cd2de63de6f14b9f0330e7ceb66.tar.gz gcc-c12ff9d8f0f20cd2de63de6f14b9f0330e7ceb66.tar.bz2 |
re PR c++/40975 (ICE in copy_tree_r on array new)
PR c++/40975
* cp-tree.def (VEC_INIT_EXPR): Add third operand.
* cp-tree.h (VEC_INIT_EXPR_NELTS): New.
* cp-gimplify.c (cp_gimplify_expr) [VEC_INIT_EXPR]: Handle it.
* tree.c (build_vec_init_expr): Handle getting pointer/nelts.
(build_vec_init_elt): Don't expect an array type.
(build_array_copy): Adjust.
* init.c (perform_member_init): Adjust.
(build_new_1): Use build_vec_init_expr.
From-SVN: r173056
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 25beba8..883734f 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -506,7 +506,8 @@ 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, NULL_TREE, + tf_warning_or_error); init = build2 (INIT_EXPR, type, decl, init); finish_expr_stmt (init); } @@ -541,7 +542,8 @@ 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, NULL_TREE, + tf_warning_or_error); init = build2 (INIT_EXPR, type, decl, init); finish_expr_stmt (init); } @@ -2384,15 +2386,14 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts, vecinit = build_tree_list_vec (*init); } init_expr - = build_vec_init (data_addr, - cp_build_binary_op (input_location, - MINUS_EXPR, outer_nelts, - integer_one_node, - complain), - vecinit, - explicit_value_init_p, - /*from_array=*/0, - complain); + = build_vec_init_expr (data_addr, + (explicit_value_init_p + ? void_type_node: vecinit), + cp_build_binary_op (input_location, + MINUS_EXPR, outer_nelts, + integer_one_node, + complain), + complain); /* An array initialization is stable because the initialization of each element is a full-expression, so the temporaries don't |