Bug 8964 – One infinite loop with foreach

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-11-05T19:06:00Z
Last change time
2013-01-16T19:02:25Z
Keywords
diagnostic
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-11-05T19:06:10Z
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?
Comment #1 by yebblies — 2013-01-16T19:02:25Z
Again! *** This issue has been marked as a duplicate of issue 5725 ***