[Issue 5725] ubyte/ushort infinite foreach loops
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 26 01:59:35 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5725
--- Comment #1 from bearophile_hugs at eml.cc 2011-06-26 01:54:29 PDT ---
Related. This compiles with no errors, and maybe goes in infinite loop:
import std.stdio;
void main() {
auto array = new int[270];
foreach (ubyte i, ref x; array)
x = i;
writeln(array);
}
If the range of the fixed-sized array is larger than the max number that the
index can represent, then I suggest to raise a compile-time error, just like
this program does:
void main() {
ubyte x = 270;
}
test.d(2): Error: cannot implicitly convert expression (270) of type int to
ubyte
--
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