Bug 3427 – Chain doesn't work w/ arrays with immutable elements.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-10-20T14:03:00Z
Last change time
2015-06-09T01:26:55Z
Keywords
patch
Assigned to
andrei
Creator
dsimcha
Comments
Comment #0 by dsimcha — 2009-10-20T14:03:13Z
import std.range;
void main() {
string a = "foo";
string b = "bar";
auto myChain = chain(a, b);
}
C:\dmd2\windows\bin\..\..\src\phobos\std\range.d(937): Error: this._input._field_field_0[index] isn't mutable
C:\dmd2\windows\bin\..\..\src\phobos\std\range.d(937): Error: this._input._field_field_1[index] isn't mutable
The fix is to test for immutability in the static if statement on line 930 of std.range:
static if (allSameType && is(typeof(_input.field[0][0] = ElementType.init)))