Debian Codegraph @

gcc/testsuite/g++.dg/init/new42.C

raw
1 // PR c++/53330
2 // { dg-do run }
3
4 extern "C" void abort ();
5
6 struct constr_empty
7 {
8 constr_empty() {};
9 };
10
11 struct noconstr_empty
12 {
13 };
14
15 struct constr_nonempty
16 {
17 constr_nonempty() {};
18 int dummy;
19 };
20
21 struct noconstr_nonempty
22 {
23 int dummy;
24 };
25
26 int main()
27 {
28 volatile constr_empty *ce = new constr_empty[0];
29 volatile noconstr_empty *ne = new noconstr_empty[0];
30 volatile constr_nonempty *cn = new constr_nonempty[0];
31 volatile noconstr_nonempty *nn = new noconstr_nonempty[0];
32 volatile int *ii = new int[0];
33
34 delete [] ce;
35 delete [] ne;
36 delete [] cn;
37 delete [] nn;
38 delete [] ii;
39
40 if (!(ce && ne && cn && nn && ii))
41 abort ();
42 }