[Issue 14930] New: Unable to array() a const map() result

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 18 05:19:47 PDT 2015


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

          Issue ID: 14930
           Summary: Unable to array() a const map() result
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: lt.infiltrator at gmail.com

import std.algorithm;
import std.array;

class S { }

class T {
   @property bar() inout { return _bar; }
   S _bar;
}

string fun() {
   auto ts = [new const T];
   ts.map!(t => t.bar).array;
}

----------------------------

/usr/include/d/4.9/std/conv.d:3914: error: static assert  "S cannot be emplaced
from a const(S)."
/usr/include/d/4.9/std/array.d:49: note: instantiated from here: emplace!(S,
const(S))
src/array.d:13: note: instantiated from here: array!(MapResult!(__lambda1,
const(T)[]))

--


More information about the Digitalmars-d-bugs mailing list