www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21991] New: allocator.dispose does not work for array of

https://issues.dlang.org/show_bug.cgi?id=21991

          Issue ID: 21991
           Summary: allocator.dispose does not work for array of qualified
                    type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: htvennik gmail.com

std.experimental.allocator.dispose does not compile for arrays of qualified
type.

----
import std.experimental.allocator : makeArray, dispose;
import std.experimental.allocator.mallocator : Mallocator;

void main()
{
    alias alloc = Mallocator.instance;

    const(int)[] arr = alloc.makeArray!int(10);
    alloc.dispose(arr);
}
----

/dlang/dmd/linux/bin64/../../src/phobos/std/experimental/allocator/package.d(2444):
Error: function
`std.experimental.allocator.mallocator.Mallocator.deallocate(void[] b) shared`
is not callable using argument types `(const(int)[]) shared`
/dlang/dmd/linux/bin64/../../src/phobos/std/experimental/allocator/package.d(2444):
       cannot pass argument `array` of type `const(int)[]` to parameter `void[]
b`
onlineapp.d(9): Error: template instance
`std.experimental.allocator.dispose!(shared(Mallocator), const(int))` error
instantiating

--
Jun 04