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: [email protected]
          Reporter: [email protected]

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.

--

Reply via email to