[Issue 15890] New: IFTI for static array argument length when element type supplied
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Apr 7 04:46:02 PDT 2016
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: nobody at puremagic.com
Reporter: ntrel-pub at mybtinternet.com
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).
--
More information about the Digitalmars-d-bugs
mailing list