cat > main.d << CODE struct Array { int[] _payload; ~this() { import core.stdc.stdlib : free; free(_payload.ptr); } } class Scanner { Array arr; this() @safe {} } CODE $ dmd -main main.d(14): Error: @safe constructor 'main.Scanner.this' cannot call @system destructor 'main.Scanner.~this'
Introduced by https://github.com/dlang/dmd/pull/6816 Also manifestates in libasync https://github.com/etcimon/libasync/blob/a56cf33720731de717ef5d6c5f1c0d51341da145/source/libasync/events.d#L57. ---- source/libasync/events.d(57,2): Error: destructor 'libasync.events.EventLoop.~this' is not nothrow source/libasync/events.d(57,2): Error: nothrow constructor 'libasync.events.EventLoop.this' may throw ----
FYI have you seen Cybershadow's comment? https://github.com/dlang/dmd/pull/6816#issuecomment-307657520 And his reduced test case for the regression in libasync? struct S { ~this() {} } class C { S s; this() nothrow {} }
(In reply to greenify from comment #2) > FYI have you seen Cybershadow's comment? > https://github.com/dlang/dmd/pull/6816#issuecomment-307657520 Ah thanks, libasync is a duplicate of issue 17494, does have the nothrow, not the `@safe` issue.
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/558773e64d42d56ad02970adfdc1371311ca3291 add test cases for existing production code - fixes Issues 17494, 17505, 17506
Commit pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/558773e64d42d56ad02970adfdc1371311ca3291 add test cases for existing production code