dmd/changelog/dmd.deprecation-dtor-fields.dd

32 lines
659 B
Text

An error is now given for constructors with field destructors with stricter attributes
```
struct HasDtor
{
~this() {}
}
struct Pure
{
HasDtor member;
this(int) pure {} // Error: `this` has stricter attributes than its destructor (`pure`)
}
struct Nothrow
{
HasDtor member;
this(int) nothrow {} // Error: `this` has stricter attributes than its destructor (`nothrow`)
}
struct NoGC
{
HasDtor member;
this(int) @nogc {} // Error: `this` has stricter attributes than its destructor (`@nogc`)
}
struct Safe
{
HasDtor member;
this(int) @safe {} // Error: `this` has stricter attributes than its destructor (`@safe`)
}
```