Bug 10433 – Array sum operation in function template

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-20T15:43:00Z
Last change time
2013-06-20T20:08:55Z
Keywords
diagnostic, pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-06-20T15:43:39Z
void foo(T)(in int[] V1, in T V2) { int[2] R; R[] = V1[] + V2[]; } void main() { immutable int[] V = [10, 20]; foo(V, V); } DMD 2.064alpha gives: test.d(3): Error: invalid array operation R[] = V1[] + cast(const(int)[])V2[] (did you forget a [] ?) test.d(7): Error: template instance test1.foo!(immutable(int)[]) error instantiating I am not sure, but I think that code should compile.
Comment #1 by k.hara.pg — 2013-06-20T19:47:17Z
Comment #2 by github-bugzilla — 2013-06-20T20:08:46Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d964f31b54a355b6b4e268457091ecd37a87c4af fix Issue 10433 - Array sum operation in function template https://github.com/D-Programming-Language/dmd/commit/1adbc5f2fdd84f7c258b40f870bd95dad41b6df5 Merge pull request #2236 from 9rnsr/fix10433 Issue 10433 - Array sum operation in function template