I've left some of the details fuzzy on purpose, because I'm not a compiler writer :)
So you want to spend another 8 years implementing linear typing for D:
http://en.wikipedia.org/wiki/Substructural_type_system
Or maybe give up @safe. Or implement either a behavioural or dependent type system. Lots of options. Lots of theory... Without type theory => leaky cauldron.