[Issue 22552] moveEmplace wipes context pointer of nested struct contained in non-nested struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 29 20:27:52 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22552

kinke <kinke at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke at gmx.net

--- Comment #1 from kinke <kinke at gmx.net> ---
(In reply to Stanislav Blinov from comment #0)
> That's because moveEmplace simply blits NotNested.init into a. Instead it
> probably should move things fieldwise and avoid wiping context pointers in
> fields that are nested structs.

Blitting the whole thing at once is still fine, but the problem arises with the
T.init reset of the source instance. It would probably really have to reset the
fields recursively in order not to clear any context pointers. There should IMO
still be a fast path for the very common case of no nested context pointers.

--


More information about the Digitalmars-d-bugs mailing list