aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-01-24 19:29:44 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-01-24 19:29:44 +0000
commit1d7bc790d78f6913a72061e526a4a89e083826a4 (patch)
tree278e354fb8fcdc27cfba50fc6e4e58fb037f44d1 /gcc/cp/tree.c
parent3e4b91f275a6fb8f6466f1ab8c9f24e3d2abf13f (diff)
downloadgcc-1d7bc790d78f6913a72061e526a4a89e083826a4.zip
gcc-1d7bc790d78f6913a72061e526a4a89e083826a4.tar.gz
gcc-1d7bc790d78f6913a72061e526a4a89e083826a4.tar.bz2
PR c++/78469 - defaulted ctor and inaccessible dtor
PR c++/78469 - defaulted ctor and inaccessible dtor * cp-tree.h (tsubst_flags): Add tf_no_cleanup. * init.c (build_new_1): Pass tf_no_cleanup to build_value_init. * tree.c (build_target_expr): Check tf_no_cleanup. PR c++/78469 * g++.dg/cpp0x/pr78469.C: New. From-SVN: r244882
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 25927ae..6fbc99e 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -404,9 +404,15 @@ build_target_expr (tree decl, tree value, tsubst_flags_t complain)
|| useless_type_conversion_p (TREE_TYPE (decl),
TREE_TYPE (value)));
- t = cxx_maybe_build_cleanup (decl, complain);
- if (t == error_mark_node)
- return error_mark_node;
+ if (complain & tf_no_cleanup)
+ /* The caller is building a new-expr and does not need a cleanup. */
+ t = NULL_TREE;
+ else
+ {
+ t = cxx_maybe_build_cleanup (decl, complain);
+ if (t == error_mark_node)
+ return error_mark_node;
+ }
t = build4 (TARGET_EXPR, type, decl, value, t, NULL_TREE);
if (EXPR_HAS_LOCATION (value))
SET_EXPR_LOCATION (t, EXPR_LOCATION (value));