[Issue 4454] New: Can't implicitly cast static arrays of primitives to immutable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 13 12:09:41 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4454

           Summary: Can't implicitly cast static arrays of primitives to
                    immutable
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2010-07-13 12:09:39 PDT ---
Now that static arrays are value types, this should be legal because there's no
mutable indirection:

void main() {
    immutable uint[2] foo = getArray();
}

uint[2] getArray() {
    uint[2] ret;
    return ret;
}


It doesn't work on 2.047.  Instead I get:

Error: cannot implicitly convert expression (getArray()) of type uint[2u] to
const(immutable(uint)[])

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


More information about the Digitalmars-d-bugs mailing list