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