Shouldn't invalid references like this fail at compile time?

Nicholas Wilson iamthewilsonator at hotmail.com
Tue Jan 23 02:43:55 UTC 2018


On Tuesday, 23 January 2018 at 02:25:57 UTC, Mike Franklin wrote:
> Not sure how to precisely define the problem here.  Should 
> `destroy` be `@system` so it can't be called in `@safe` code, 
> or should the compiler be smart enough to figure out the flow 
> control and throw an error?
>
> Mike

The compiler should be taught that any access to a `.destroy()`ed 
object is invalid i.e. that its lifetime ends when destroy is 
called.


More information about the Digitalmars-d mailing list