[Issue 12876] New: Implicit cast of array slice to fixed-size array for templates too
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jun 8 03:40:43 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12876
Issue ID: 12876
Summary: Implicit cast of array slice to fixed-size array for
templates too
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: rejects-valid
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
I am not sure this is a valid enhancement request. This code could be accepted:
void foo(int[4] b) {}
void bar(size_t N)(int[N] c) {}
void main() {
int[5] a;
foo(a[1 .. $]); // OK
bar(a[1 .. $]); // Error.
}
DMD 2.066alpha gives:
test.d(6,8): Error: template test.bar cannot deduce function from argument
types !()(int[]), candidates are:
test.d(2,6): test.bar(uint N)(int[N] c)
--
More information about the Digitalmars-d-bugs
mailing list