DIP1014, DIP1000 and use-after-move bugs

Paul Backus snarwin at gmail.com
Thu Jul 11 13:33:03 UTC 2019


On Thursday, 11 July 2019 at 10:19:16 UTC, Max Haughton wrote:
> I think "DIP1000"(i.e. whatever it becomes) should eventually 
> disallow use after move.
>
> This should probably be by default but allow tagging a move 
> operator as safe to reuse.
>
> I haven't got a clue where to start an implementation but I 
> think this would be a good step once DIP1014 is implemented.

I don't think this can be done without adding something like 
Rust's borrow checker to D.

Since D's `move` resets the moved-from object to its .init value, 
a use-after-move is just a logic error, not undefined behavior, 
so there's nothing un- at safe about it.


More information about the Digitalmars-d mailing list