[Issue 17448] Move semantics cause memory corruption and cryptic bugs

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed May 31 11:17:16 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17448

--- Comment #15 from Shachar Shemesh <shachar at weka.io> ---
(In reply to Andrei Alexandrescu from comment #14)

> * On the language definition side: the proposal would need to differentiate
> among (a) constructs that are guaranteed to not move; (b) operations that
> may move if possible (for optimization purposes) or not depending on
> "@disable move", and (c) operations that must always move and therefore are
> disallowed for "@disable move" objects.
> 

You do not need to disallow anything if you require that "@disable move" on
struct "Struct" always be accompanied by "this(Struct rhs)" constructor (i.e. -
a move constructor).

This way, you can move when applicable, and move through the provided callback
where applicable.

--


More information about the Digitalmars-d-bugs mailing list