digitalmars.D.bugs - [Issue 21704] New: Nullable fails to destroy static array elements
- d-bugmail puremagic.com (33/33) Mar 12 2021 https://issues.dlang.org/show_bug.cgi?id=21704
https://issues.dlang.org/show_bug.cgi?id=21704 Issue ID: 21704 Summary: Nullable fails to destroy static array elements Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: snarwin+bugzilla gmail.com Example program: --- import std.typecons, std.array; bool destroyed; struct Probe { ~this() { destroyed=true; } } void main() { { Nullable!(Probe[1]) example = staticArray([Probe()]); destroyed = false; } assert(destroyed); } --- The `Probe` instance inside `example` should have its destructor called when `example` goes out of scope. Since it does not, the assertion fails. --
Mar 12 2021