www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14466] New: destructive move


          Issue ID: 14466
           Summary: destructive move
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

Currently the moved from object has to be reinitialized in order to avoid
double freeing in it's destructor.
Both operations reinitialization and destroying the moved from object are
superfluous, if we had a mean to tell the compiler not to destroy a particular

A destructive move intrinsic would turn an object into an rvalue, disable
destruction of the moved from object, and disallow any further usage of the
moved from object.
The object must be unaliased to make destructive move  safe.
Destructively moving anything but named variables (such as fields or single
array elements) would be prohibited as it adds compiler complexity or runtime

Apr 19 2015