[Issue 12282] New: Immutable result of std.array.array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 1 08:47:24 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12282

           Summary: Immutable result of std.array.array
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2014-03-01 08:47:19 PST ---
I am not sure if this is an enhancement:


void main() {
    import std.array: array;
    const a = [1];
    immutable b = a.array;
}


DMD 2.066alpha gives:

test.d(4,20): Error: cannot implicitly convert expression (array(a)) of type
const(int)[] to immutable(int[])


Another example shows the same problem:

void main() pure {
    import std.range: transversal;
    import std.array: array;
    const m = [[1.0, 2.0], [3.0, 4.0]];
    immutable first = m.transversal(0).array;
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list