https://issues.dlang.org/show_bug.cgi?id=17448
--- Comment #9 from Shachar Shemesh <shac...@weka.io> --- There are two issues here. The first is that @safe does not warn about unsafe behavior. Interesting, but unrelated to the Weka use case. The more interesting problem here is that certain types of programming are impossible in D. I was unable to find the statement in the most recent language specs, but the phrasing I remember from "The D Programming Language" was along the lines of "Structs in D may not store references to themselves, and therefor D may move them around memory at will". Except that is not true. First, the order is reverse. D moves them around, and that's why they may not store references to themselves. More to the point, however, the requirement should be made much more stringent: D structs may not manage, directly or indirectly, any reference to themselves, either internally as a member, or externally. Like I stated above, that's a fairly big restriction. At the very least, the training material should be updated to reflect it correctly, possibly also the specs. As things currently stand, there is no way to write a struct the manages its own registration in an outside container without using dynamic memory (which is never mentioned in the specs as an exception to that rule). --