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: [email protected]
Reporter: [email protected]
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.
--