www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14751] New: std.array.array doesn't work with ranges of

https://issues.dlang.org/show_bug.cgi?id=14751

          Issue ID: 14751
           Summary: std.array.array doesn't work with ranges of immutable
                    classes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: japplegame gmail.com

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))

--
Jun 30 2015