digitalmars.D.bugs - [Issue 15187] New: dispose for allocators is broken
- via Digitalmars-d-bugs (34/34) Oct 11 2015 https://issues.dlang.org/show_bug.cgi?id=15187
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 puremagic.com Reporter: ilyayaroshenko 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]); } --
Oct 11 2015