www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8964] New: One infinite loop with foreach

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



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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE



Again!

*** This issue has been marked as a duplicate of issue 5725 ***

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