https://issues.dlang.org/show_bug.cgi?id=9570
--- Comment #8 from [email protected] --- (In reply to yebblies from comment #7) > void main() { > ubyte[256] data; > foreach (ubyte i, ref x; data) { > i = 99999; > x = i; // information lost > } > } This code should give (as it currently gives): temp.d(4,13): Error: cannot implicitly convert expression (99999) of type int to ubyte Here i scan a ubyte range 0 .. 255, so tagging it as ubyte is OK. I think it's irrelevant that later I try to overflow the contents of i. Even this is OK for D, despite 'i' gets overflowed: void main() { ubyte[256] data; foreach (ubyte i, ref x; data) { i += 200; i = 200; x = i; } } So I still don't see the problem. --
