www.digitalmars.com         C & C++   DMDScript  

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


          Issue ID: 14751
           Summary: std.array.array doesn't work with ranges of immutable
           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
/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