From 5bb451b72029dee9a744bf69d2be133248ebe04e Mon Sep 17 00:00:00 2001 From: paolo Date: Wed, 12 Aug 2015 22:38:04 +0000 Subject: [PATCH] 2015-08-12 Paolo Carlini PR c++/53330 * g++.dg/init/new42.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226840 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/init/new42.C | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 gcc/testsuite/g++.dg/init/new42.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20735b946b6..1b49702fd74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-12 Paolo Carlini + + PR c++/53330 + * g++.dg/init/new42.C: New. + 2015-08-12 Michael Meissner PR target/67071 diff --git a/gcc/testsuite/g++.dg/init/new42.C b/gcc/testsuite/g++.dg/init/new42.C new file mode 100644 index 00000000000..12a714a4bef --- /dev/null +++ b/gcc/testsuite/g++.dg/init/new42.C @@ -0,0 +1,42 @@ +// PR c++/53330 +// { dg-do run } + +extern "C" void abort (); + +struct constr_empty +{ + constr_empty() {}; +}; + +struct noconstr_empty +{ +}; + +struct constr_nonempty +{ + constr_nonempty() {}; + int dummy; +}; + +struct noconstr_nonempty +{ + int dummy; +}; + +int main() +{ + volatile constr_empty *ce = new constr_empty[0]; + volatile noconstr_empty *ne = new noconstr_empty[0]; + volatile constr_nonempty *cn = new constr_nonempty[0]; + volatile noconstr_nonempty *nn = new noconstr_nonempty[0]; + volatile int *ii = new int[0]; + + delete [] ce; + delete [] ne; + delete [] cn; + delete [] nn; + delete [] ii; + + if (!(ce && ne && cn && nn && ii)) + abort (); +} -- 2.11.4.GIT