www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6884] New: Some static bounds tests on dynamic arrays too

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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Nov 02 2011