https://issues.dlang.org/show_bug.cgi?id=18283
--- Comment #1 from Mike Franklin <[email protected]> --- Interestingly, `destroy` is an unsafe operation for classes. import std.stdio; class A { void hello() @safe { writeln("hello"); } } void main() @safe { A a = new A(); a.hello(); destroy(a); // onlineapp.d(12): Error: @safe function 'D main' cannot call // @system function 'object.destroy!(A).destroy' a.hello(); } https://run.dlang.io/is/AwKBc3 But it's not an unsafe operation for pointers import std.stdio; struct A { int i; void print() @safe { writeln(i); } } void main() @safe { A* a = new A(); a.print(); // OK a.destroy(); a.print(); // Error! } https://run.dlang.io/is/Fm7qBR I'm not sure what the language authors' intentions are, so I can't say whether the bug is in SafeD, or in the implementation of `destroy`. --
