www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14930] New: Unable to array() a const map() result


          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 puremagic.com
          Reporter: lt.infiltrator 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,
src/array.d:13: note: instantiated from here: array!(MapResult!(__lambda1,

Aug 18 2015