[Issue 6884] New: Some static bounds tests on dynamic arrays too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 2 17:16:56 PDT 2011


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

           Summary: Some static bounds tests on dynamic arrays too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-11-02 17:16:28 PDT ---
I'd like DMD to catch at compile-time some of the following bugs (with DMD
2.056 this gives no compile-time errors):


void main() {
    int[] x = new int[5];
    x[$] = 1; // easy
    x[x.length] = 1; // idem
    enum size_t n = 2;
    x[$ + n] = 2; // not too much hard if n is unsigned
    x[x.length + n] = 2; // idem
}


See also bug 6883

-- 
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