www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12504] New: Wrong 'cannot cover index range' error message

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12504

           Summary: Wrong 'cannot cover index range' error message
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



void main() {
    int[256] data;
    foreach (ubyte i; 0 .. data.length) {} // OK
    foreach (ubyte i, x; data) {}          // Error
}


test.d(4,5): Error: index type 'ubyte' cannot cover index range 0..256

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 01 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12504


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



13:02:59 CEST ---
Similar to Issue 1878. I think I've even seen this bug reported somewhere
though..

And a similar thread from 2011:
http://forum.dlang.org/thread/ik8tq5$1ma0$1 digitalmars.com

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 02 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12504





 Similar to Issue 1878. I think I've even seen this bug reported somewhere
 though..
 
 And a similar thread from 2011:
 http://forum.dlang.org/thread/ik8tq5$1ma0$1 digitalmars.com
But the since 1878 and year 2011 the foreach situation is changed. So I think it's a bug (or missed case) in the recent improvements of foreach. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 02 2014