[Issue 6079] New: [CTFE] Array index out of bound detection is off-by-one

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 31 02:05:09 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6079

           Summary: [CTFE] Array index out of bound detection is
                    off-by-one
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: accepts-invalid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-05-31 01:59:48 PDT ---
Test case:

------------------------
static assert({
    int[] x = [1,2,3,4];
    x[4] = 1;
    return true;
}());
------------------------

In 2.052 this is correctly rejected, but in 2.053 this is wrongly accepted.
Changing the [4] to [5] will make the code fail to compile. There should be
some off-by-one error introduced between the two versions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list