[Issue 1878] New: foreach does not handle integral types appropriately
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 28 13:01:43 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1878
Summary: foreach does not handle integral types appropriately
Product: D
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: andrei at metalanguage.com
ubyte limit = whatever();
ubyte x;
foreach (e; 0 .. limit)
x = e;
does not compile with warnings enabled. The compiler should recognize that a
compile-time constant (in this case 0) is passed in and choose the tightest
type (in this case ubyte) for iteration.
--
More information about the Digitalmars-d-bugs
mailing list