[Issue 10880] New: foreach on matrix literal refuses immutable iteration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 24 08:55:20 PDT 2013


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

           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 at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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
foreach:


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


More information about the Digitalmars-d-bugs mailing list