int main(string[] argv) { auto crash = cast(Foo*)&_addr; return 0; } yes both Foo and _addr are undefined and dmd issues errors for that but then it sill crashes with an assert: main.d(22): Error: identifier 'Foo' is not defined main.d(22): Error: Foo is used as a type Assertion failure: 'tn->mod & MODimmutable || tn->mod & MODconst' on line 875 in file 'mtype.c' Tested on windows using dmd2.049
*** This issue has been marked as a duplicate of issue 4434 ***