long[] f(byte[] a) { return cast(long[])a[0..a.length/8*8]; } Here the compiler can see that the array length is multiple of 8 and simply divide the length by 8 for the cast.
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19497 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB