http://d.puremagic.com/issues/show_bug.cgi?id=9947
Summary: reduce of an array of structs with an immutable field
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from [email protected] 2013-04-16 16:16:16 PDT ---
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
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------