D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14751 - std.array.array doesn't work with ranges of immutable classes
Summary: std.array.array doesn't work with ranges of immutable classes
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-30 13:29 UTC by Jack Applegame
Modified: 2016-01-10 14:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jack Applegame 2015-06-30 13:29:59 UTC
import std.array;
import std.range;
import std.algorithm;

class Foo {
}

void main() {
	auto result = iota(3).map!(i => new immutable Foo).array();
}

/usr/include/dmd/phobos/std/conv.d(4028): Error: cannot implicitly convert expression (arg) of type immutable(Foo) to test.Foo
/usr/include/dmd/phobos/std/conv.d(3931): Error: template instance std.conv.emplaceImpl!(immutable(Foo)).emplaceImpl!(immutable(Foo)) error instantiating
/usr/include/dmd/phobos/std/array.d(115):        instantiated from here: emplaceRef!(immutable(Foo), Foo, immutable(Foo))
test.d(9):        instantiated from here: array!(MapResult!(__lambda1, Result))
Comment 1 Jack Applegame 2015-08-04 10:48:16 UTC
Fix - https://github.com/D-Programming-Language/phobos/pull/3524
Comment 2 Jack Applegame 2016-01-10 14:01:32 UTC
Reasons of this issue and issue 15313 are the same.
Fixing issue 1513 also fixed this one.