void main(immutable string[] argv) @safe @live {
class Test {
string a;
}
auto testInstance = new Test;
testInstance.a = "Test String";
import std.stdio;
testInstance.a.writeln;
testInstance = null;
testInstance.a.writeln;
}
/* Terminal output:
Test String
Segmentation fault
*/
Of course, this code must spit out a segmentation fault, as dereferencing null is illegal. However, the problem is, that it lets me compile the program in @safe.
I'm not entirely sure about what testInstance is defined as, but I assume it's a reference. I don't think dereferencing null should be allowed in SafeD. Or is this a design decision of D?