www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Cannot dispose const array?

Hi Dlang community!

I've stumbled on an interesting issue with allocators. It seems 
that we can't get disposed of arrays with const or immutable 
data. Consider example below:

Link: https://run.dlang.io/is/frnQI8
import std.stdio;
import std.range;
import std.algorithm;
import std.experimental.allocator;
import std.experimental.allocator.mallocator;

void main(string[] args) {
     const(int)[] values = Mallocator.instance.makeArray!(const 
int)([1, 2, 3, 4]);


We'd get following error:
or/package.d(2398): Error: function
std.experimental.allocator.mallocator.Mallocator.deallocate(void[] b) shared is
not callable using argument types (const(int)[]) shared
or/package.d(2398):        cannot pass argument array of type const(int)[] to
parameter void[] b

onlineapp.d(11): Error: template instance 
const(int))` error instantiating

Is it expected to not be able to dispose out of immutable or 
const data, or it is a bug that should be fixed?

Aug 08 2018