[Issue 5306] New: Disallow foreach ref on numeric interval

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 1 18:26:24 PST 2010


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

           Summary: Disallow foreach ref on numeric interval
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-12-01 18:24:54 PST ---
This code compiles and runs with no errors with DMD 2.050, but I think this
code is meaningless so it needs to be disallowed statically (items in the
interval are not lvalues): 


void main() {
    foreach (ref i; 0 .. 10) {
        i++;
    }
}

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