11// REQUIRED_ARGS: -o-
22
3+ /*
4+ TEST_OUTPUT:
5+ ---
6+ fail_compilation/fail14486.d(81): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
7+ fail_compilation/fail14486.d(82): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
8+ fail_compilation/fail14486.d(83): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
9+ fail_compilation/fail14486.d(84): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
10+ fail_compilation/fail14486.d(85): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
11+ fail_compilation/fail14486.d(99): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
12+ fail_compilation/fail14486.d(100): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
13+ fail_compilation/fail14486.d(101): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
14+ fail_compilation/fail14486.d(102): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
15+ fail_compilation/fail14486.d(103): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
16+ fail_compilation/fail14486.d(123): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
17+ fail_compilation/fail14486.d(124): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
18+ fail_compilation/fail14486.d(125): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
19+ fail_compilation/fail14486.d(126): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
20+ fail_compilation/fail14486.d(127): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
21+ fail_compilation/fail14486.d(141): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
22+ fail_compilation/fail14486.d(142): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
23+ fail_compilation/fail14486.d(143): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
24+ fail_compilation/fail14486.d(144): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
25+ fail_compilation/fail14486.d(145): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
26+ fail_compilation/fail14486.d(164): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
27+ fail_compilation/fail14486.d(165): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
28+ fail_compilation/fail14486.d(166): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
29+ fail_compilation/fail14486.d(167): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
30+ fail_compilation/fail14486.d(168): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
31+ fail_compilation/fail14486.d(181): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
32+ fail_compilation/fail14486.d(182): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
33+ fail_compilation/fail14486.d(183): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
34+ fail_compilation/fail14486.d(184): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
35+ fail_compilation/fail14486.d(185): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
36+ ---
37+ */
38+
339class C0a { }
440class C1a { ~this () {} }
541class C2a { ~this () {} @nogc pure @safe delete (void * p) {} }
@@ -27,18 +63,19 @@ struct S4b { nothrow ~this() {} nothrow delete(void* p) {} }
2763/*
2864TEST_OUTPUT:
2965---
30- fail_compilation/fail14486.d(44): Error: `delete c0` is not `@safe` but is used in `@safe` function `test1a`
31- fail_compilation/fail14486.d(45): Error: `pure` function `fail14486.test1a` cannot call impure destructor `fail14486.C1a.~this`
32- fail_compilation/fail14486.d(45): Error: `@safe` function `fail14486.test1a` cannot call `@system` destructor `fail14486.C1a.~this`
33- fail_compilation/fail14486.d(45): Error: `@nogc` function `fail14486.test1a` cannot call non-@nogc destructor `fail14486.C1a.~this`
34- fail_compilation/fail14486.d(46): Error: `pure` function `fail14486.test1a` cannot call impure destructor `fail14486.C2a.~this`
35- fail_compilation/fail14486.d(46): Error: `@safe` function `fail14486.test1a` cannot call `@system` destructor `fail14486.C2a.~this`
36- fail_compilation/fail14486.d(46): Error: `@nogc` function `fail14486.test1a` cannot call non-@nogc destructor `fail14486.C2a.~this`
37- fail_compilation/fail14486.d(47): Error: `pure` function `fail14486.test1a` cannot call impure deallocator `fail14486.C3a.delete`
38- fail_compilation/fail14486.d(47): Error: `@safe` function `fail14486.test1a` cannot call `@system` deallocator `fail14486.C3a.delete`
39- fail_compilation/fail14486.d(47): Error: `@nogc` function `fail14486.test1a` cannot call non-@nogc deallocator `fail14486.C3a.delete`
40- fail_compilation/fail14486.d(48): Error: `delete c4` is not `@safe` but is used in `@safe` function `test1a`
41- ---*/
66+ fail_compilation/fail14486.d(81): Error: `delete c0` is not `@safe` but is used in `@safe` function `test1a`
67+ fail_compilation/fail14486.d(82): Error: `pure` function `fail14486.test1a` cannot call impure destructor `fail14486.C1a.~this`
68+ fail_compilation/fail14486.d(82): Error: `@safe` function `fail14486.test1a` cannot call `@system` destructor `fail14486.C1a.~this`
69+ fail_compilation/fail14486.d(82): Error: `@nogc` function `fail14486.test1a` cannot call non-@nogc destructor `fail14486.C1a.~this`
70+ fail_compilation/fail14486.d(83): Error: `pure` function `fail14486.test1a` cannot call impure destructor `fail14486.C2a.~this`
71+ fail_compilation/fail14486.d(83): Error: `@safe` function `fail14486.test1a` cannot call `@system` destructor `fail14486.C2a.~this`
72+ fail_compilation/fail14486.d(83): Error: `@nogc` function `fail14486.test1a` cannot call non-@nogc destructor `fail14486.C2a.~this`
73+ fail_compilation/fail14486.d(84): Error: `pure` function `fail14486.test1a` cannot call impure deallocator `fail14486.C3a.delete`
74+ fail_compilation/fail14486.d(84): Error: `@safe` function `fail14486.test1a` cannot call `@system` deallocator `fail14486.C3a.delete`
75+ fail_compilation/fail14486.d(84): Error: `@nogc` function `fail14486.test1a` cannot call non-@nogc deallocator `fail14486.C3a.delete`
76+ fail_compilation/fail14486.d(85): Error: `delete c4` is not `@safe` but is used in `@safe` function `test1a`
77+ ---
78+ */
4279void test1a () @nogc pure @safe
4380{
4481 C0a c0; delete c0; // error
@@ -51,10 +88,10 @@ void test1a() @nogc pure @safe
5188/*
5289TEST_OUTPUT:
5390---
54- fail_compilation/fail14486.d(63 ): Error: destructor `fail14486.C1b.~this` is not `nothrow`
55- fail_compilation/fail14486.d(64 ): Error: destructor `fail14486.C2b.~this` is not `nothrow`
56- fail_compilation/fail14486.d(65 ): Error: deallocator `fail14486.C3b.delete` is not `nothrow`
57- fail_compilation/fail14486.d(60 ): Error: `nothrow` function `fail14486.test1b` may throw
91+ fail_compilation/fail14486.d(100 ): Error: destructor `fail14486.C1b.~this` is not `nothrow`
92+ fail_compilation/fail14486.d(101 ): Error: destructor `fail14486.C2b.~this` is not `nothrow`
93+ fail_compilation/fail14486.d(102 ): Error: deallocator `fail14486.C3b.delete` is not `nothrow`
94+ fail_compilation/fail14486.d(97 ): Error: `nothrow` function `fail14486.test1b` may throw
5895---
5996*/
6097void test1b () nothrow
@@ -69,16 +106,16 @@ void test1b() nothrow
69106/*
70107TEST_OUTPUT:
71108---
72- fail_compilation/fail14486.d(86 ): Error: `delete s0` is not `@safe` but is used in `@safe` function `test2a`
73- fail_compilation/fail14486.d(87 ): Error: `pure` function `fail14486.test2a` cannot call impure destructor `fail14486.S1a.~this`
74- fail_compilation/fail14486.d(87 ): Error: `@safe` function `fail14486.test2a` cannot call `@system` destructor `fail14486.S1a.~this`
75- fail_compilation/fail14486.d(87 ): Error: `@nogc` function `fail14486.test2a` cannot call non-@nogc destructor `fail14486.S1a.~this`
76- fail_compilation/fail14486.d(88 ): Error: `pure` function `fail14486.test2a` cannot call impure destructor `fail14486.S2a.~this`
77- fail_compilation/fail14486.d(88 ): Error: `@safe` function `fail14486.test2a` cannot call `@system` destructor `fail14486.S2a.~this`
78- fail_compilation/fail14486.d(88 ): Error: `@nogc` function `fail14486.test2a` cannot call non-@nogc destructor `fail14486.S2a.~this`
79- fail_compilation/fail14486.d(89 ): Error: `pure` function `fail14486.test2a` cannot call impure deallocator `fail14486.S3a.delete`
80- fail_compilation/fail14486.d(89 ): Error: `@safe` function `fail14486.test2a` cannot call `@system` deallocator `fail14486.S3a.delete`
81- fail_compilation/fail14486.d(89 ): Error: `@nogc` function `fail14486.test2a` cannot call non-@nogc deallocator `fail14486.S3a.delete`
109+ fail_compilation/fail14486.d(123 ): Error: `delete s0` is not `@safe` but is used in `@safe` function `test2a`
110+ fail_compilation/fail14486.d(124 ): Error: `pure` function `fail14486.test2a` cannot call impure destructor `fail14486.S1a.~this`
111+ fail_compilation/fail14486.d(124 ): Error: `@safe` function `fail14486.test2a` cannot call `@system` destructor `fail14486.S1a.~this`
112+ fail_compilation/fail14486.d(124 ): Error: `@nogc` function `fail14486.test2a` cannot call non-@nogc destructor `fail14486.S1a.~this`
113+ fail_compilation/fail14486.d(125 ): Error: `pure` function `fail14486.test2a` cannot call impure destructor `fail14486.S2a.~this`
114+ fail_compilation/fail14486.d(125 ): Error: `@safe` function `fail14486.test2a` cannot call `@system` destructor `fail14486.S2a.~this`
115+ fail_compilation/fail14486.d(125 ): Error: `@nogc` function `fail14486.test2a` cannot call non-@nogc destructor `fail14486.S2a.~this`
116+ fail_compilation/fail14486.d(126 ): Error: `pure` function `fail14486.test2a` cannot call impure deallocator `fail14486.S3a.delete`
117+ fail_compilation/fail14486.d(126 ): Error: `@safe` function `fail14486.test2a` cannot call `@system` deallocator `fail14486.S3a.delete`
118+ fail_compilation/fail14486.d(126 ): Error: `@nogc` function `fail14486.test2a` cannot call non-@nogc deallocator `fail14486.S3a.delete`
82119---
83120*/
84121void test2a () @nogc pure @safe
@@ -93,10 +130,10 @@ void test2a() @nogc pure @safe
93130/*
94131TEST_OUTPUT:
95132---
96- fail_compilation/fail14486.d(105 ): Error: destructor `fail14486.S1b.~this` is not `nothrow`
97- fail_compilation/fail14486.d(106 ): Error: destructor `fail14486.S2b.~this` is not `nothrow`
98- fail_compilation/fail14486.d(107 ): Error: deallocator `fail14486.S3b.delete` is not `nothrow`
99- fail_compilation/fail14486.d(102 ): Error: `nothrow` function `fail14486.test2b` may throw
133+ fail_compilation/fail14486.d(142 ): Error: destructor `fail14486.S1b.~this` is not `nothrow`
134+ fail_compilation/fail14486.d(143 ): Error: destructor `fail14486.S2b.~this` is not `nothrow`
135+ fail_compilation/fail14486.d(144 ): Error: deallocator `fail14486.S3b.delete` is not `nothrow`
136+ fail_compilation/fail14486.d(139 ): Error: `nothrow` function `fail14486.test2b` may throw
100137---
101138*/
102139void test2b () nothrow
@@ -111,15 +148,15 @@ void test2b() nothrow
111148/*
112149TEST_OUTPUT:
113150---
114- fail_compilation/fail14486.d(127 ): Error: `delete a0` is not `@safe` but is used in `@safe` function `test3a`
115- fail_compilation/fail14486.d(128 ): Error: `pure` function `fail14486.test3a` cannot call impure destructor `fail14486.S1a.~this`
116- fail_compilation/fail14486.d(128 ): Error: `@safe` function `fail14486.test3a` cannot call `@system` destructor `fail14486.S1a.~this`
117- fail_compilation/fail14486.d(128 ): Error: `@nogc` function `fail14486.test3a` cannot call non-@nogc destructor `fail14486.S1a.~this`
118- fail_compilation/fail14486.d(129 ): Error: `pure` function `fail14486.test3a` cannot call impure destructor `fail14486.S2a.~this`
119- fail_compilation/fail14486.d(129 ): Error: `@safe` function `fail14486.test3a` cannot call `@system` destructor `fail14486.S2a.~this`
120- fail_compilation/fail14486.d(129 ): Error: `@nogc` function `fail14486.test3a` cannot call non-@nogc destructor `fail14486.S2a.~this`
121- fail_compilation/fail14486.d(130 ): Error: `delete a3` is not `@safe` but is used in `@safe` function `test3a`
122- fail_compilation/fail14486.d(131 ): Error: `delete a4` is not `@safe` but is used in `@safe` function `test3a`
151+ fail_compilation/fail14486.d(164 ): Error: `delete a0` is not `@safe` but is used in `@safe` function `test3a`
152+ fail_compilation/fail14486.d(165 ): Error: `pure` function `fail14486.test3a` cannot call impure destructor `fail14486.S1a.~this`
153+ fail_compilation/fail14486.d(165 ): Error: `@safe` function `fail14486.test3a` cannot call `@system` destructor `fail14486.S1a.~this`
154+ fail_compilation/fail14486.d(165 ): Error: `@nogc` function `fail14486.test3a` cannot call non-@nogc destructor `fail14486.S1a.~this`
155+ fail_compilation/fail14486.d(166 ): Error: `pure` function `fail14486.test3a` cannot call impure destructor `fail14486.S2a.~this`
156+ fail_compilation/fail14486.d(166 ): Error: `@safe` function `fail14486.test3a` cannot call `@system` destructor `fail14486.S2a.~this`
157+ fail_compilation/fail14486.d(166 ): Error: `@nogc` function `fail14486.test3a` cannot call non-@nogc destructor `fail14486.S2a.~this`
158+ fail_compilation/fail14486.d(167 ): Error: `delete a3` is not `@safe` but is used in `@safe` function `test3a`
159+ fail_compilation/fail14486.d(168 ): Error: `delete a4` is not `@safe` but is used in `@safe` function `test3a`
123160---
124161*/
125162void test3a () @nogc pure @safe
@@ -134,9 +171,9 @@ void test3a() @nogc pure @safe
134171/*
135172TEST_OUTPUT:
136173---
137- fail_compilation/fail14486.d(145 ): Error: destructor `fail14486.S1b.~this` is not `nothrow`
138- fail_compilation/fail14486.d(146 ): Error: destructor `fail14486.S2b.~this` is not `nothrow`
139- fail_compilation/fail14486.d(142 ): Error: `nothrow` function `fail14486.test3b` may throw
174+ fail_compilation/fail14486.d(182 ): Error: destructor `fail14486.S1b.~this` is not `nothrow`
175+ fail_compilation/fail14486.d(183 ): Error: destructor `fail14486.S2b.~this` is not `nothrow`
176+ fail_compilation/fail14486.d(179 ): Error: `nothrow` function `fail14486.test3b` may throw
140177---
141178*/
142179void test3b () nothrow
0 commit comments