← Back to index
|
Original Bugzilla link
Bug 14751 – std.array.array doesn't work with ranges of immutable classes
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-06-30T13:29:00Z
Last change time
2016-01-10T14:01:32Z
Assigned to
nobody
Creator
japplegame
Comments
Comment #0
by japplegame — 2015-06-30T13:29:59Z
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
by japplegame — 2015-08-04T10:48:16Z
Fix -
https://github.com/D-Programming-Language/phobos/pull/3524
Comment #2
by japplegame — 2016-01-10T14:01:32Z
Reasons of this issue and issue 15313 are the same. Fixing issue 1513 also fixed this one.