public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-8149] c++: add test [PR105265]
@ 2022-04-14  0:22 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-04-14  0:22 UTC (permalink / raw)
  To: gcc-cvs

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;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-14  0:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14  0:22 [gcc r12-8149] c++: add test [PR105265] Jason Merrill

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).