1 // REQUIRED_ARGS: -vgc -o-
4 /***************** NewExp *******************/
7 struct S2 { this(int); }
8 struct S3 { this(int) @nogc; }
9 struct S4 { new(size_t); }
10 struct S5 { @nogc new(size_t); }
15 compilable/vgc1.d(27): vgc: 'new' causes GC allocation
16 compilable/vgc1.d(29): vgc: 'new' causes GC allocation
17 compilable/vgc1.d(30): vgc: 'new' causes GC allocation
18 compilable/vgc1.d(32): vgc: 'new' causes GC allocation
19 compilable/vgc1.d(33): vgc: 'new' causes GC allocation
20 compilable/vgc1.d(34): vgc: 'new' causes GC allocation
21 compilable/vgc1.d(38): vgc: 'new' causes GC allocation
29 int[] a1 = new int[3];
30 int[][] a2 = new int[][](2, 3);
35 S4* ps4 = new S4; // no error
36 S5* ps5 = new S5; // no error
38 Object o1 = new Object();
44 compilable/vgc1.d(55): vgc: 'new' causes GC allocation
45 compilable/vgc1.d(57): vgc: 'new' causes GC allocation
46 compilable/vgc1.d(58): vgc: 'new' causes GC allocation
47 compilable/vgc1.d(60): vgc: 'new' causes GC allocation
48 compilable/vgc1.d(61): vgc: 'new' causes GC allocation
49 compilable/vgc1.d(62): vgc: 'new' causes GC allocation
55 scope int* p1 = new int;
57 scope int[] a1 = new int[3];
58 scope int[][] a2 = new int[][](2, 3);
60 scope S1* ps1 = new S1();
61 scope S2* ps2 = new S2(1);
62 scope S3* ps3 = new S3(1);
63 scope S4* ps4 = new S4; // no error
64 scope S5* ps5 = new S5; // no error
66 scope Object o1 = new Object(); // no error
67 scope o2 = new Object(); // no error
72 /***************** DeleteExp *******************/
77 compilable/vgc1.d(84): vgc: 'delete' requires GC
78 compilable/vgc1.d(85): vgc: 'delete' requires GC
79 compilable/vgc1.d(86): vgc: 'delete' requires GC
82 void testDelete(int* p, Object o, S1* s)