[Issue 14751] New: std.array.array doesn't work with ranges of immutable classes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 30 06:29:59 PDT 2015


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 at puremagic.com
          Reporter: japplegame at 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))

--


More information about the Digitalmars-d-bugs mailing list