View mode: basic / threaded / horizontal-split · Log in · Help
February 22, 2013
[Issue 9572] New: Missed wrong implicit integral conversion

          Summary: Missed wrong implicit integral conversion
          Product: D
          Version: D2
         Platform: All
       OS/Version: All
           Status: NEW
         Keywords: accepts-invalid, diagnostic
         Severity: normal
         Priority: P2
        Component: DMD

--- Comment #0 from 2013-02-22 11:09:10 PST ---
void main() {
   int[300] data;
   foreach (ubyte i, x; data) {} // Line 3, no error.
   ubyte j = data.length; // Line 4, Error.

DMD 2.063alpha gives:

temp.d(4): Error: cannot implicitly convert expression (300u) of type uint to

But line 3 should give a similar error message, because data has 300 items, so
the "i" index can't represent all the possible indexes.

See also issue 9570.

Configure issuemail:
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home