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)
Comment #1 by k.hara.pg — 2014-06-08T12:35:27Z
Comment #2 by github-bugzilla — 2014-06-09T04:32:03Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d76628d7079e99c1f81e3021005db6e4f883d4d0 fix Issue 12876 - Implicit cast of array slice to fixed-size array for templates too https://github.com/D-Programming-Language/dmd/commit/2af0ad7ecc7e7287ada4650823a7678c9a537253 Merge pull request #3650 from 9rnsr/fix12876 Issue 12876 - Implicit cast of array slice to fixed-size array for templates too