aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-new2.C15
3 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6daee41..e371a40 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2019-12-11 Jason Merrill <jason@redhat.com>
+ PR c++/57082 - new X{} and private destructor.
+ * init.c (build_new_1): Also pass tf_no_cleanup to
+ build_special_member_call.
+
PR c++/92774 - ICE with implicitly deleted operator<=>.
* method.c (comp_info::~comp_info): Factor out of...
(build_comparison_op): Here. Handle error return from build_new_op.
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index e40afe2..ecd0951 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3591,7 +3591,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
complete_ctor_identifier,
init, elt_type,
LOOKUP_NORMAL,
- complain);
+ complain|tf_no_cleanup);
}
else if (explicit_value_init_p)
{
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-new2.C b/gcc/testsuite/g++.dg/cpp0x/initlist-new2.C
new file mode 100644
index 0000000..d873138
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-new2.C
@@ -0,0 +1,15 @@
+// PR c++/57082
+// { dg-do compile { target c++11 } }
+
+struct X
+{
+private:
+ ~X() {}
+};
+
+int main()
+{
+ new X; // OK
+ new X(); // OK
+ new X{}; // ERROR
+}