Bug 12876 – Implicit cast of array slice to fixed-size array for templates too
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-06-08T10:40:00Z
Last change time
2014-06-09T04:32:04Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2014-06-08T10:40:43Z
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)