Thread overview
[Issue 16180] Unable to dispose an interface with std.experiment.allocator
Jun 17, 2016
b2.temp@gmx.com
Jun 17, 2016
Maik Klein
Jun 17, 2016
b2.temp@gmx.com
Mar 21, 2020
Basile-z
June 17, 2016
https://issues.dlang.org/show_bug.cgi?id=16180

b2.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from b2.temp@gmx.com ---
(In reply to Maik Klein from comment #0)
> I opened a stack overflow question which contains all the needed details
> 
> http://stackoverflow.com/questions/37868594/disposing-a-class-with-an- interface?lq=1

There a dispose overload that works with interface. It's available because you can retrieve the object that implements the interface using "cast(Object) itf".

So to me the report is invalid:

uint a;
interface Bar{}
class Foo: Bar
{
    ~this(){a = 1;}
}

void main()
{
    import std.experimental.allocator.mallocator;
    import std.experimental.allocator;
    auto f = Mallocator.instance.make!Foo();
    Bar b = f;
    Mallocator.instance.dispose(b);
    assert(a == 1);
}
June 17, 2016
https://issues.dlang.org/show_bug.cgi?id=16180

--- Comment #2 from Maik Klein <maikklein@googlemail.com> ---
Okay I found the bug. It was using emsi_container as a dependency, even though I did not use it.

It seems to have a dependency on std.experimental.allocator version 2.70, which then somehow overshadowed the current version of std.experimental.allocator.

And the bug that I am reporting still existed in 2.70 but seems to be fixed in 2.71.

So I guess I maybe should report this as an dub issue?

--
June 17, 2016
https://issues.dlang.org/show_bug.cgi?id=16180

--- Comment #3 from b2.temp@gmx.com ---
I don't know. It's maybe worth asking Hackerpilot if his fork is still needed,
the issues are addressed now, almost a year after the pull to phobos.
In emsi containers the submodule allocators is very outdated:

https://github.com/Hackerpilot/experimental_allocator/tree/cd8196a5b063b9019ea5529239da3181cc4fdc4f

--
June 18, 2016
https://issues.dlang.org/show_bug.cgi?id=16180

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei@erdani.com
         Resolution|---                         |INVALID

--- Comment #4 from Andrei Alexandrescu <andrei@erdani.com> ---
Looks like we can close this on the stdlib side.

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=16180

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--