2 Informative error messages if the compiler inserted an optional destructor call into the constructor.
4 REQUIRED_ARGS: -preview=dtorfields
7 fail_compilation/dtorfields_attributes.d(117): Error: `pure` constructor `dtorfields_attributes.Strict.this` cannot call impure destructor `dtorfields_attributes.Strict.~this`
8 fail_compilation/dtorfields_attributes.d(119): generated `Strict.~this` is impure because of the following field's destructors:
9 fail_compilation/dtorfields_attributes.d(115): - HasDtor member
10 fail_compilation/dtorfields_attributes.d(103): impure `HasDtor.~this` is declared here
11 fail_compilation/dtorfields_attributes.d(117): Error: `@safe` constructor `dtorfields_attributes.Strict.this` cannot call `@system` destructor `dtorfields_attributes.Strict.~this`
12 fail_compilation/dtorfields_attributes.d(119): `dtorfields_attributes.Strict.~this` is declared here
13 fail_compilation/dtorfields_attributes.d(119): generated `Strict.~this` is @system because of the following field's destructors:
14 fail_compilation/dtorfields_attributes.d(115): - HasDtor member
15 fail_compilation/dtorfields_attributes.d(103): @system `HasDtor.~this` is declared here
16 fail_compilation/dtorfields_attributes.d(117): Error: `@nogc` constructor `dtorfields_attributes.Strict.this` cannot call non-@nogc destructor `dtorfields_attributes.Strict.~this`
17 fail_compilation/dtorfields_attributes.d(119): generated `Strict.~this` is non-@nogc because of the following field's destructors:
18 fail_compilation/dtorfields_attributes.d(115): - HasDtor member
19 fail_compilation/dtorfields_attributes.d(103): non-@nogc `HasDtor.~this` is declared here
28 // Enforce @system, ... just to be sure
31 throw new Exception(new immutable(char)[](10));
35 // The user-defined dtor matches the ctor attributes
40 this(int) pure @nogc @safe {} // nothrow doesn't generate dtor call
42 ~this() pure @nogc @safe {}