https://issues.dlang.org/show_bug.cgi?id=15187
Issue ID: 15187
Summary: dispose for allocators is broken
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
Current code:
================
void dispose(A, T)(auto ref A alloc, T* p)
{
static if (hasElaborateDestructor!T)
{
destroy(*p);
}
alloc.deallocate(p[0 .. T.sizeof]);
}
Should be:
================
void dispose(A, T)(auto ref A alloc, T* p)
{
static if (hasElaborateDestructor!T)
{
destroy(*p);
}
alloc.deallocate((cast(void*)p)[0 .. T.sizeof]);
}
--