Bug 22337 – `std.container.Array` object leak (on failed construction)

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-27T12:18:59Z
Last change time
2024-12-01T16:39:22Z
Assigned to
No Owner
Creator
DoctorNoobingstoneIPresume
Moved to GitHub: phobos#9830 →

Comments

Comment #0 by adder.thief+1 — 2021-09-27T12:18:59Z
`std.container.Array`: The constructor taking variadic arguments (which is used in e.g.: `auto a = Array (S (0), S (1), S (2), S(3));`: If `emplace`-ing one of the given elements in the newly-created `Array` fails (by `throw`-ing an `Exception`), the construction of the `Array` fails (by propagating the `Exception`) (and this is correct), but the already-`emplace`-d elements are not destroyed (and this is incorrect). Details and `unittest` and proposed fix: https://github.com/dlang/phobos/pull/8162.
Comment #1 by robert.schadek — 2024-12-01T16:39:22Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9830 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB