Bug 20768 – [DIP1014] __move_post_blt must recursively call itself on static arrays whose elements are structs or static arrays that recursively contain structs

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-04-26T07:23:46Z
Last change time
2020-05-27T04:46:53Z
Keywords
pull
Assigned to
No Owner
Creator
Nathan S.

Comments

Comment #0 by n8sh.secondary — 2020-04-26T07:23:46Z
Example of current erroneous behavior: --- void main() { static struct A { bool movedInto; void opPostMove(const ref A oldLocation) { movedInto = true; } } static struct B { A[2] a; } B src, dest; __move_post_blt(dest, src); foreach (ref a; src.a) assert(!a.movedInto); foreach (ref a; dest.a) assert(a.movedInto); // This currently fails. } ---
Comment #1 by dlang-bot — 2020-04-26T07:44:51Z
@n8sh created dlang/druntime pull request #3065 "[DIP1014] __move_post_blt: recursively call on fields that are static arrays & do not recursively call on non-field members" fixing this issue: - Fix Issue 20768 - __move_post_blt must recursively call itself on static arrays whose elements are structs or static arrays that recursively contain structs [DIP1014] NB: this fix disregards DIP1014's advice to either not use hasElaborateMove!T within __move_post_blt or to use it only once at the start of the function. https://github.com/dlang/druntime/pull/3065
Comment #2 by dlang-bot — 2020-05-27T04:46:53Z
dlang/druntime pull request #3065 "[DIP1014] __move_post_blt: recursively call on fields that are static arrays & do not recursively call on non-field members" was merged into master: - e4b00e7370d031797991cac124982e23ae85ea53 by Nathan Sashihara: Fix Issue 20768 - __move_post_blt must recursively call itself on static arrays whose elements are structs or static arrays that recursively contain structs [DIP1014] NB: this fix disregards DIP1014's advice to either not use hasElaborateMove!T within __move_post_blt or to use it only once at the start of the function. https://github.com/dlang/druntime/pull/3065