]>
Commit | Line | Data |
---|---|---|
5fee5ec3 IB |
1 | /** |
2 | Checks that code still compiles when -preview=dtorfields is enabled by default | |
3 | but issues an appropriate deprecation message. | |
4 | ||
5 | Remove this test when the deprecations period ends, see visit(CtorDeclaration) | |
6 | in semantic3.d | |
7 | ||
8 | TEST_OUTPUT: | |
9 | --- | |
10 | compilable/dtorfields_deprecation.d(30): Deprecation: `dtorfields_deprecation.Pure.this` has stricter attributes than its destructor (`pure`) | |
11 | compilable/dtorfields_deprecation.d(30): The destructor will be called if an exception is thrown | |
12 | compilable/dtorfields_deprecation.d(30): Either make the constructor `nothrow` or adjust the field destructors | |
13 | compilable/dtorfields_deprecation.d(42): Deprecation: `dtorfields_deprecation.NoGC.this` has stricter attributes than its destructor (`@nogc`) | |
14 | compilable/dtorfields_deprecation.d(42): The destructor will be called if an exception is thrown | |
15 | compilable/dtorfields_deprecation.d(42): Either make the constructor `nothrow` or adjust the field destructors | |
16 | compilable/dtorfields_deprecation.d(48): Deprecation: `dtorfields_deprecation.Safe.this` has stricter attributes than its destructor (`@system`) | |
17 | compilable/dtorfields_deprecation.d(48): The destructor will be called if an exception is thrown | |
18 | compilable/dtorfields_deprecation.d(48): Either make the constructor `nothrow` or adjust the field destructors | |
19 | --- | |
20 | **/ | |
21 | ||
22 | struct HasDtor | |
23 | { | |
24 | ~this() {} | |
25 | } | |
26 | ||
27 | struct Pure | |
28 | { | |
29 | HasDtor member; | |
30 | this(int) pure {} | |
31 | } | |
32 | ||
33 | struct Nothrow | |
34 | { | |
35 | HasDtor member; | |
36 | this(int) nothrow {} | |
37 | } | |
38 | ||
39 | struct NoGC | |
40 | { | |
41 | HasDtor member; | |
42 | this(int) @nogc {} | |
43 | } | |
44 | ||
45 | struct Safe | |
46 | { | |
47 | HasDtor member; | |
48 | this(int) @safe {} | |
49 | } |