www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10880] New: foreach on matrix literal refuses immutable iteration


           Summary: foreach on matrix literal refuses immutable iteration
           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

--- Comment #0 from bearophile_hugs eml.cc 2013-08-24 08:55:18 PDT ---
A matrix literal can be assigned to an immutable, but this isn't done in a

void main() {
    immutable m1 = [[1]]; // OK
    foreach (immutable v; [[1]]) {} // error

dmd 2.064alpha gives:

test.d(3): Error: cannot implicitly convert expression (__aggr4[__key5]) of
type int[] to immutable(int[])

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