[Issue 15721] New: std.experimental.allocator dispose on interface
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Feb 25 02:29:33 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15721
Issue ID: 15721
Summary: std.experimental.allocator dispose on interface
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: installer
Assignee: nobody at puremagic.com
Reporter: joeyemmons at yahoo.com
Seems calling dispose on an interface does not work. The following will cause
free to fail:
// someOutputRange is a ubyte[] output range of type O
auto malloc = Mallocator.instance;
OutputRange!(ubyte[]) range;
range = malloc.make!(OutputRangeObject!(O, ubyte[]))(someOutputRange);
// do some stuff...
malloc.dispose(range);
It fails because typeid on interfaces is wonky, who thought that was a good
idea...
It can be fixed by changing to:
malloc.dispose(cast(Object)range);
But honestly it should not be necessary and will 100% trip people up.
--
More information about the Digitalmars-d-bugs
mailing list