www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15721] New: std.experimental.allocator dispose on interface


          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 puremagic.com
          Reporter: joeyemmons 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...


It fails because typeid on interfaces is wonky, who thought that was a good

It can be fixed by changing to: 
But honestly it should not be necessary and will 100% trip people up.

Feb 25 2016