[Issue 8964] New: One infinite loop with foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 5 19:06:11 PST 2012


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

           Summary: One infinite loop with foreach
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-11-05 19:06:10 PST ---
With DMD 2.061alpha this code compiles with no errors or warnings, and it goes
in infinite loop at run-time:


void main() {
    int[256] arr;
    foreach (ubyte i, x; arr) {}
}


Is it a good idea to add a compile-time test in the D compiler to statically
forbid such code? Or maybe just a warning?

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