[Issue 6883] New: Array static bounds tests with $ too
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Nov  2 17:12:44 PDT 2011
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=6883
           Summary: Array static bounds tests with $ 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:12:14 PDT ---
D2 code:
void main() {
    int[5] x;
    x[x.length] = 1;
    enum size_t n = 2;
    x[x.length + n] = 2;
}
DMD 2.056 gives at compile-time:
test.d(3): Error: array index 5 is out of bounds x[0 .. 5]
test.d(5): Error: array index 7 is out of bounds x[0 .. 5]
I'd like this similar program to give similar compile-time errors (with DMD
2.056 it gives no compile errors, and gives just run-time errors in debug
mode):
void main() {
    int[5] x;
    x[$] = 1;
    enum size_t n = 2;
    x[$ + n] = 2;
}
-- 
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