public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-8149] c++: add test [PR105265]
Date: Thu, 14 Apr 2022 00:22:33 +0000 (GMT)	[thread overview]
Message-ID: <20220414002233.171473858D3C@sourceware.org> (raw)

https://gcc.gnu.org/g:019d6d4149ee97d55ce9efe4e5e470d38130cdeb

commit r12-8149-g019d6d4149ee97d55ce9efe4e5e470d38130cdeb
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 13 12:44:54 2022 -0400

    c++: add test [PR105265]
    
    This was fixed by r12-1165, but good to have a test that doesn't need
    -fno-elide-constructors.
    
            PR c++/105265
            PR c++/100838
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp0x/initlist-new6.C: New test.

Diff:
---
 gcc/testsuite/g++.dg/cpp0x/initlist-new6.C | 39 ++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-new6.C b/gcc/testsuite/g++.dg/cpp0x/initlist-new6.C
new file mode 100644
index 00000000000..0ef27806acf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-new6.C
@@ -0,0 +1,39 @@
+// PR c++/105265
+// { dg-do run { target c++11 } }
+
+int c;
+
+class Block
+{
+public:
+  Block(int n) : data{new char[n]}, size{n}
+  {
+    ++c;
+  }
+
+  ~Block()
+  {
+    --c;
+    delete[] data;
+  }
+
+private:
+  char* data;
+  int size;
+};
+
+struct Cargo
+{
+  Block const& block;
+};
+
+int main()
+{
+  {
+    Cargo* c = new Cargo{{4000}};
+    delete c;
+  }
+  if (c != 0)
+    __builtin_abort ();
+  return 0;
+}


                 reply	other threads:[~2022-04-14  0:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220414002233.171473858D3C@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).