Bug 22554 – moveEmplace should wipe any source that contains pointers

Status
NEW
Severity
enhancement
Priority
P4
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-11-30T09:52:59Z
Last change time
2024-12-07T13:41:31Z
Assigned to
No Owner
Creator
Stanislav Blinov
Moved to GitHub: dmd#17431 →

Comments

Comment #0 by stanislav.blinov — 2021-11-30T09:52:59Z
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).
Comment #1 by robert.schadek — 2024-12-07T13:41:31Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17431 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB