Do you know why this program doesn't compile (with DMD 2.056head)?

immutable(int[]) foo(in int[] x) pure {
    return new int[1];
}
void main() {}


It gives:
test.d(2): Error: cannot implicitly convert expression (new int[](1u)) of type 
int[] to immutable(int[])

This program instead compiles (now x is int[2] instead of int[]):

immutable(int[]) foo(in int[2] x) pure {
    return new int[1];
}
void main() {}


Bye and thank you,
bearophile

Reply via email to