www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1878] New: foreach does not handle integral types appropriately

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 digitalmars.com
        ReportedBy: andrei 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.


-- 
Feb 28 2008