https://issues.dlang.org/show_bug.cgi?id=23561
Issue ID: 23561
Summary: std.typecons.Unique!struct does not destroy struct
instance
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
void main()
{
import std.typecons;
int i;
struct S
{
~this() { i++; }
}
{
Unique!S u = new S;
}
assert(i == 1); // fails
}
Unique.~this calls destroy on the S*, not the struct instance:
if (_p !is null)
{
destroy(_p);
_p = null;
}
--