On Wednesday, 19 July 2017 at 12:34:50 UTC, Stefan Koch wrote:
Which leaves the scope after assigning. And therefore triggers the destructor.
No, that's not the case. There is a temporary, but its destructor is not called. The existing object in `foo` is destroyed, so the new one can be moved (and indeed moved, not copied, so no postblit, no dtor call, though it might or might not invalidate internal pointers - that's why the spec bans those) into its place.