www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22970] New: importC: taking address one past array end gives

https://issues.dlang.org/show_bug.cgi?id=22970

          Issue ID: 22970
           Summary: importC: taking address one past array end gives
                    bounds error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser neet.fi
                CC: duser neet.fi

int xs[5];
void fn()
{
        for (int *p = &xs[0]; p < &xs[5]; p++)
                ;
}

Error: array index 5 is out of bounds `[0..5]`

--
Apr 02 2022