On 8/15/17 10:42 AM, Kagamin wrote:
https://github.com/dlang/phobos/blob/master/std/variant.d#L623
memcpy(&store, cast(const(void*)) &rhs, rhs.sizeof);

should be ok to cast unconditionally

Agreed, the T value being copied has already been copied onto the stack, so it's not really shared.

However, I'm not sure about the postblit being called afterward. Does a postblit need to be marked shared in order to work for shared types?

I think also I understand why it's working for shared int* but not shared int -- IFTI automatically infers tail-modified for such things to cut down on instantiations. tail-modified means the head is not shared (which is in this case more accurate). This means the cast is not necessary, since you are copying unqualified data.

-Steve

Reply via email to