www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7663] New: Mutable array of chars assigned to immutable fixed size array too

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Mar 07 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7663


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |WORKSFORME



21:52:57 PST ---
Fixed in 2.061.

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