aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/init.cc')
-rw-r--r--gcc/cp/init.cc31
1 files changed, 16 insertions, 15 deletions
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index 0ab0aaa..3d5d390 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -686,6 +686,8 @@ get_nsdmi (tree member, bool in_ctor, tsubst_flags_t complain)
/* Now put it back so C++17 copy elision works. */
init = get_target_expr (init);
+ set_target_expr_eliding (init);
+
current_class_ptr = save_ccp;
current_class_ref = save_ccr;
return init;
@@ -1006,7 +1008,7 @@ perform_member_init (tree member, tree init, hash_set<tree> &uninitialized)
if (TREE_CODE (type) == ARRAY_TYPE)
{
init = build_vec_init_expr (type, init, tf_warning_or_error);
- init = build2 (INIT_EXPR, type, decl, init);
+ init = cp_build_init_expr (decl, init);
finish_expr_stmt (init);
}
else
@@ -1014,7 +1016,7 @@ perform_member_init (tree member, tree init, hash_set<tree> &uninitialized)
tree value = build_value_init (type, tf_warning_or_error);
if (value == error_mark_node)
return;
- init = build2 (INIT_EXPR, type, decl, value);
+ init = cp_build_init_expr (decl, value);
finish_expr_stmt (init);
}
}
@@ -1025,7 +1027,7 @@ perform_member_init (tree member, tree init, hash_set<tree> &uninitialized)
{
if (init)
{
- init = build2 (INIT_EXPR, type, decl, TREE_VALUE (init));
+ init = cp_build_init_expr (decl, TREE_VALUE (init));
finish_expr_stmt (init);
}
}
@@ -1062,7 +1064,7 @@ perform_member_init (tree member, tree init, hash_set<tree> &uninitialized)
if (TREE_CODE (type) == ARRAY_TYPE
&& TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (type)))
init = build_vec_init_expr (type, init, tf_warning_or_error);
- init = build2 (INIT_EXPR, type, decl, init);
+ init = cp_build_init_expr (decl, init);
finish_expr_stmt (init);
FOR_EACH_VEC_ELT (*cleanups, i, t)
push_cleanup (NULL_TREE, t, false);
@@ -1081,7 +1083,7 @@ perform_member_init (tree member, tree init, hash_set<tree> &uninitialized)
/* Initialize the array only if it's not a flexible
array member (i.e., if it has an upper bound). */
init = build_vec_init_expr (type, init, tf_warning_or_error);
- init = build2 (INIT_EXPR, type, decl, init);
+ init = cp_build_init_expr (decl, init);
finish_expr_stmt (init);
}
}
@@ -2097,7 +2099,7 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags,
complete objects. */
gcc_assert (TREE_CODE (init) == CONSTRUCTOR || true_exp == exp);
- init = build2 (INIT_EXPR, TREE_TYPE (exp), exp, init);
+ init = cp_build_init_expr (exp, init);
TREE_SIDE_EFFECTS (init) = 1;
finish_expr_stmt (init);
return true;
@@ -2136,8 +2138,7 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags,
TREE_TYPE (*p) = void_type_node;
p = &TREE_OPERAND (*p, 0);
}
- *p = build2 (INIT_EXPR, TREE_TYPE (exp), exp, *p);
- TREE_SIDE_EFFECTS (*p) = 1;
+ *p = cp_build_init_expr (exp, *p);
finish_expr_stmt (init);
return true;
}
@@ -2202,7 +2203,7 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags,
{
tree e = maybe_constant_init (rval, exp);
if (TREE_CONSTANT (e))
- rval = build2 (INIT_EXPR, type, exp, e);
+ rval = cp_build_init_expr (exp, e);
}
}
@@ -2290,7 +2291,7 @@ expand_aggr_init_1 (tree binfo, tree true_exp, tree exp, tree init, int flags,
field_size = TYPE_SIZE (CLASSTYPE_AS_BASE (type));
init = build_zero_init_1 (type, NULL_TREE, /*static_storage_p=*/false,
field_size);
- init = build2 (INIT_EXPR, type, exp, init);
+ init = cp_build_init_expr (exp, init);
finish_expr_stmt (init);
}
@@ -3678,7 +3679,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
tree val = build_value_init (type, complain | tf_no_cleanup);
if (val == error_mark_node)
return error_mark_node;
- init_expr = build2 (INIT_EXPR, type, init_expr, val);
+ init_expr = cp_build_init_expr (init_expr, val);
}
else
{
@@ -4430,7 +4431,7 @@ build_vec_init (tree base, tree maxindex, tree init,
if (BRACE_ENCLOSED_INITIALIZER_P (init))
init = digest_init (atype, init, complain);
- stmt_expr = build2 (INIT_EXPR, atype, base, init);
+ stmt_expr = cp_build_init_expr (base, init);
return stmt_expr;
}
@@ -4602,7 +4603,7 @@ build_vec_init (tree base, tree maxindex, tree init,
gcc_checking_assert (!target_expr_needs_replace (elt));
if (digested)
- one_init = build2 (INIT_EXPR, type, baseref, elt);
+ one_init = cp_build_init_expr (baseref, elt);
else if (tree vi = get_vec_init_expr (elt))
one_init = expand_vec_init_expr (baseref, vi, complain, flags);
else if (MAYBE_CLASS_TYPE_P (type) || TREE_CODE (type) == ARRAY_TYPE)
@@ -4623,7 +4624,7 @@ build_vec_init (tree base, tree maxindex, tree init,
if (do_static_init)
one_init = NULL_TREE;
else
- one_init = build2 (INIT_EXPR, type, baseref, e);
+ one_init = cp_build_init_expr (baseref, e);
}
else
{
@@ -4805,7 +4806,7 @@ build_vec_init (tree base, tree maxindex, tree init,
{
elt_init = build_value_init (type, complain);
if (elt_init != error_mark_node)
- elt_init = build2 (INIT_EXPR, type, to, elt_init);
+ elt_init = cp_build_init_expr (to, elt_init);
}
else
{