mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
32 lines
661 B
Text
32 lines
661 B
Text
An error is now given for constructors when a field's destructor has 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`)
|
|
}
|
|
```
|