2.074.0-regression in move semantics

Nordlöw via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 22 05:01:25 PDT 2017


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



More information about the Digitalmars-d mailing list