October 15, 2014 [Issue 13619] New: std.container.array capacity not updated when length increases | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13619 Issue ID: 13619 Summary: std.container.array capacity not updated when length increases Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: trivial Priority: P1 Component: Phobos Assignee: nobody@puremagic.com Reporter: dlang@thedeemon.com import std.container; void main() { Array!int a; // empty Array a.length = 10; // now payload is allocated, length is set to 10, but capacity is still 0! // try to append a value a ~= 1; // runtime error (assertion: capacity < length !) } Fix is trivial, Array.Payload.length setter must update _capacity field when it reallocates data. -- |
Copyright © 1999-2021 by the D Language Foundation