On Thu., 26 Jul. 2018, 2:45 am RazvanN via Digitalmars-d, < digitalmars-d@puremagic.com> wrote:
> > void opAssign(ref $q1 S rhs) // version 3 > { > S tmp1 = rhs; // call copy constructor > void[S.sizeof] tmp2 = void; > > // swapbits(tmp1, this); > memcpy(tmp2, this); > memcpy(this, tmp1); > memcpy(tmp1, tmp2); > > tmp1.__dtor(); > } > Uh oh, you feel for the trap! You can't destruct like this. __xdtor at least, but even then it's not so simple. I think emplace() should be lifted to druntime, and destroy() should be complemented by destruct(), which will not post-assign .init.