https://d.puremagic.com/issues/show_bug.cgi?id=9947
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #2 from [email protected] 2014-02-25 12:27:55 PST --- (In reply to comment #0) > Maybe this should work: > > > import std.algorithm: reduce; > struct Foo { > immutable int x; > } > void main() { > auto data = [Foo(0)]; > reduce!((a, b) => a)(data); > } > > > > DMD 2.063alpha gives: > > ...\dmd2\src\phobos\std\algorithm.d(702): Error: cannot modify struct result > Foo with immutable members > ...\dmd2\src\phobos\std\algorithm.d(723): Error: template instance > test.main.reduce!(__lambda3).reduce!(Foo,Foo[]) error instantiating > test.d(7): instantiated from here: reduce!(Foo[]) > test.d(7): Error: template instance > test.main.reduce!(__lambda3).reduce!(Foo[]) > error instantiating I think it is acceptable to require that whatever the type being reduced be assignable? It would be more friendly if it asserts though. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
