April 26, 2019 [Issue 19830] New: core.memory.__delete destructs arrays of structs in the wrong order | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19830 Issue ID: 19830 Summary: core.memory.__delete destructs arrays of structs in the wrong order Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody@puremagic.com Reporter: slavo5150@yahoo.com 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. -- |
Copyright © 1999-2021 by the D Language Foundation