Bug 19830 – core.memory.__delete destructs arrays of structs in the wrong order

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-04-26T14:09:07Z
Last change time
2019-04-26T15:25:45Z
Keywords
pull
Assigned to
No Owner
Creator
Mike Franklin

Comments

Comment #0 by slavo5150 — 2019-04-26T14:09:07Z
int sdtor8; struct S8 { int b = 7; int c; ~this() { printf("~S8() %d\n", sdtor8); assert(b == 7); assert(sdtor8 == c); sdtor8++; } } void test8() { S8[] s = new S8[3]; s[0].c = 2; s[1].c = 1; s[2].c = 0; delete s; assert(sdtor8 == 3); } assertion failure at `assert(sdtor8 == c)` due to __delete destructing in the order 0,1,2 instead of the order 2,1,0.
Comment #1 by dlang-bot — 2019-04-26T14:14:40Z
@JinShil created dlang/druntime pull request #2585 "Fix Issue 19830 - core.memory.__delete destructs arrays of structs in the wrong order" fixing this issue: - Fix Issue 19830 - core.memory.__delete destructs arrays of structs in the wrong order https://github.com/dlang/druntime/pull/2585
Comment #2 by dlang-bot — 2019-04-26T15:25:45Z
dlang/druntime pull request #2585 "Fix Issue 19830 - core.memory.__delete destructs arrays of structs in the wrong order" was merged into stable: - 80a2f793602324b48e65c7e50e3af7cfb891686f by JinShil: Fix Issue 19830 - core.memory.__delete destructs arrays of structs in the wrong order https://github.com/dlang/druntime/pull/2585