I had thought following case.

```d
// with -m64 switch
void main() {
    ubyte[cast(size_t)(long.max + 1)] data;
    foreach (ubyte i, x; data) {}
    // Error: index type 'ubyte' cannot cover index range 0..9223372036854775808UL  <-- UL is important
}
```

...However, currently it prints following message

```
$ dmd -m64 -o- test
test.d(4): Error: index -9223372036854775808 overflow for static array
```

As a conclusion, static array dimension is limited in `TypeSArray::size`. So in this case it won't be an issue. So using `toInteger` is correct if foreach statement aggregate is static array.