diff options
author | Nathan Sidwell <nathan@acm.org> | 2017-01-24 19:29:44 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2017-01-24 19:29:44 +0000 |
commit | 1d7bc790d78f6913a72061e526a4a89e083826a4 (patch) | |
tree | 278e354fb8fcdc27cfba50fc6e4e58fb037f44d1 /gcc/cp/init.c | |
parent | 3e4b91f275a6fb8f6466f1ab8c9f24e3d2abf13f (diff) | |
download | gcc-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/init.c')
-rw-r--r-- | gcc/cp/init.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 15388b1..de43d81 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -3262,8 +3262,10 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts, } else if (explicit_value_init_p) { - /* Something like `new int()'. */ - tree val = build_value_init (type, complain); + /* Something like `new int()'. NO_CLEANUP is needed so + we don't try and build a (possibly ill-formed) + destructor. */ + 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); |