https://issues.dlang.org/show_bug.cgi?id=15890
Issue ID: 15890
Summary: IFTI for static array argument length when element
type supplied
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
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).
--