Better handling of noncopyable objects and objects with this(this)

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 1 10:49:33 PDT 2015


On 6/1/15 10:38 AM, Timon Gehr wrote:
> On 06/01/2015 07:30 PM, Andrei Alexandrescu wrote:
>> On 6/1/15 9:40 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>"
>> wrote:
>>> The question is not what should happen when someone does a conditional
>>> _explicit_ move, but whether a move should be done _implicitly_ by the
>>> compiler given the above constellation, and how it deals with the
>>> destructor if yes.
>>
>> At language level the compiler has control over generating the
>> destructor, so it won't if it's doing a move. Note that this is STATIC
>> analysis. -- Andrei
>
> Static analysis is perfectly capable of figuring this case out. He is
> asking about how much sophistication will be guaranteed by the language
> specification, and what the exact rules are.

It should be enough to do the move only if all paths of execution end in 
the same conversion to rvalue. -- Andrei


More information about the Digitalmars-d mailing list