D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3427 - Chain doesn't work w/ arrays with immutable elements.
Summary: Chain doesn't work w/ arrays with immutable elements.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: Andrei Alexandrescu
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2009-10-20 14:03 UTC by David Simcha
Modified: 2015-06-09 01:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2009-10-20 14:03:13 UTC
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)))
Comment 1 David Simcha 2009-12-01 09:53:31 UTC
This should be fixed along with bug 3311 in SVN.