http://d.puremagic.com/issues/show_bug.cgi?id=11276
--- Comment #2 from Kenji Hara <[email protected]> 2013-10-16 01:34:41 PDT --- (In reply to comment #0) > This could be a problem in DMD and one related but different in Phobos. > > This used to work: > > import std.algorithm: reduce; > struct Foo { int x, y; } > void main() { > Foo[] data = [{10, 20}, {30, 40}]; > reduce!((a, b) => a[] += [b.x, b.y][])([0, 0], data); > } > > > Now it gives (dmd 2.064beta1): > > test.d(5): Error: invalid array operation a[] += [b.x, b.y] (did you forget a > [] ?) > ...\dmd2\src\phobos\std\algorithm.d(763): Error: template instance > test.main.__lambda1!(int[], Foo) error instantiating > test.d(5): instantiated from here: reduce!(int[], Foo[]) > test.d(5): Error: template instance test.main.reduce!((a, b) => a[] += [b.x, > b.y][]).reduce!(int[], Foo[]) error instantiating This is a duplicate issue of bug 10684. I'll increased importance of the issue. (In reply to comment #0) > Expanding the lambda doesn't fully solve the problem (now compiling with > "-wi"): > > import std.algorithm: reduce; > struct Foo { int x, y; } > void main() { > Foo[] data = [{10, 20}, {30, 40}]; > reduce!((a, b) { int[2] c = [b.x, b.y]; > a[] += c[]; > return c;})([0, 0], data); > } > > Gives: > > ...\dmd2\src\phobos\std\algorithm.d(763): Warning: explicit slice assignment > result = (__lambda1(result, front(_param_1)))[] is better than result = > __lambda1(result, front(_param_1)) This is a regression caused by implementing issue 7444. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
