digitalmars.D.bugs - [Issue 22554] New: moveEmplace should wipe any source that contains
- d-bugmail puremagic.com (26/26) Nov 30 2021 https://issues.dlang.org/show_bug.cgi?id=22554
https://issues.dlang.org/show_bug.cgi?id=22554 Issue ID: 22554 Summary: moveEmplace should wipe any source that contains pointers Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: stanislav.blinov gmail.com Currently, moveEmplace only wipes sources that contain structs with destructors and copy ctors. Basically, its current design assumes programs that use GC and not manual allocations. Seeing as move/moveEmplace are mechanisms to pass ownership at runtime, they really should do a better job on that and wipe any sources that contain pointers (with the exception of context pointers of nested structs). In other words, this: auto ptr1 = &thing; auto ptr2 = move(ptr1); assert(!ptr1); // would fail with current implementation of moveEmplace Of course, this should extend to all pointers in disguise (static arrays of void, reference types, slices, delegates, and certainly unions). --
Nov 30 2021