www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - 2.074.0-regression in move semantics

reply =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
AFAICT, release 2.074.0 has regressed move semantics in function 
return statements.

As a consequence, my package

     https://github.com/nordlow/gmp-d/

no longer compiles.

At master branch, `dub build` now errors as


Performing "debug" build using /usr/bin/dmd for x86_64.
gmp-d 0.0.1+commit.126.g660d82b: building configuration 
"library"...
src/gmp/z.d(484,20): Error: struct gmp.z.MpZ is not copyable 
because it is annotated with  disable
src/gmp/q.d(205,16): Error: template instance 
gmp.z.MpZ.opBinary!"/" error instantiating
src/gmp/z.d(168,16): Error: struct gmp.z.MpZ is not copyable 
because it is annotated with  disable
src/gmp/z.d(921,16): Error: struct gmp.z.MpZ is not copyable 
because it is annotated with  disable
/usr/bin/dmd failed with exit code 1.


which means that the return statement at

https://github.com/nordlow/gmp-d/blob/660d82b99abeef2b26ef3c9c4525d08a2aafdc55/src/gmp/z.d#L484

can no longer move the expression `y`.

I don't understand why this specific case fails when others in 
the standard library apparently hasn't.

Help, please.
Apr 22 2017
next sibling parent =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Saturday, 22 April 2017 at 11:54:12 UTC, Nordlöw wrote:
 which means that the return statement at

 https://github.com/nordlow/gmp-d/blob/660d82b99abeef2b26ef3c9c4525d08a2aafdc55/src/gmp/z.d#L484

 can no longer move the expression `y`.
Note that changing the line 484 containing return y; to return move(y); instead fails as /usr/include/dmd/phobos/std/algorithm/mutation.d(1207,12): Error: struct gmp.z.MpZ is not copyable because it is annotated with disable /usr/include/dmd/phobos/std/algorithm/mutation.d(1200,20): Error: template instance std.algorithm.mutation.moveImpl!(MpZ) error instantiating /usr/include/dmd/phobos/std/algorithm/mutation.d(1162,31): instantiated from here: trustedMoveImpl!(MpZ) src/gmp/z.d(484,24): instantiated from here: move!(MpZ) src/gmp/q.d(205,16): instantiated from here: opBinary!"/" src/gmp/z.d(168,16): Error: struct gmp.z.MpZ is not copyable because it is annotated with disable src/gmp/z.d(921,16): Error: struct gmp.z.MpZ is not copyable because it is annotated with disable
Apr 22 2017
prev sibling parent Martin Nowak <code dawg.eu> writes:
On Saturday, 22 April 2017 at 11:54:12 UTC, Nordlöw wrote:
 can no longer move the expression `y`.

 I don't understand why this specific case fails when others in 
 the standard library apparently hasn't.

 Help, please.
Please file a regression at issues.dlang.org and prefix the subject with "[Reg 2.074.0]".
Apr 22 2017