[Issue 15187] New: dispose for allocators is broken
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Oct 11 10:03:52 PDT 2015
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: nobody at puremagic.com
Reporter: ilyayaroshenko at gmail.com
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]);
}
--
More information about the Digitalmars-d-bugs
mailing list