dmd 2.070.2 doesn't always support inference of n, but not T, for a static array argument:
T[n] staticArray(T, size_t n)(T[n] arr)
{
return arr;
}
unittest
{
immutable(int)[2] arr = [1,2]; // OK
immutable(int)[2] isa = [1,2].staticArray!(immutable int); // cannot deduce
int[2] sa = [1,2].staticArray!(int); // OK
immutable(int)[2] isa2 = [1,2].staticArray!(immutable int, 2); // OK
}
(staticArray is from a Phobos PR: https://github.com/D-Programming-Language/phobos/pull/4090).
Comment #1 by robert.schadek — 2024-12-13T18:47:23Z