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