[Issue 7663] New: Mutable array of chars assigned to immutable fixed size array too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 7 11:01:27 PST 2012


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

           Summary: Mutable array of chars assigned to immutable fixed
                    size array too
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-03-07 11:01:29 PST ---
void main() {
    char[] a = "hello".dup;
    immutable char[4] s = a[0 .. 4];
}


DMD 2.059head gives:

test.d(3): Error: cannot implicitly convert expression (a[0u..4u]) of type
char[] to const(immutable(char)[])


But I think it's easy to see the assignment is valid, even at compile-time.

-- 
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