This code compiles since 2.084.(1/0?) but it is illegal: --- ubyte[1] ice(ubyte[1] data) { ubyte[1] result = data[] & [42]; return result; } void main() { assert (ice([1]) == [0]); } --- But fails at runtime with a range violation. Previously it was rejected with the message: --- Error: cannot implicitly convert expression `data[] & [42]` of type `int[]` to `ubyte[]` --- Which should still be the case, unless 42 is cast to ubyte or constructed as ubyte(42). The backend has a protection to detect the illegal element but it's not written correctly. It uses the style `assert(!condition)` instead of `if (condition) assert(0);` and because of that an ICE does not happen when DMD is compiled with -release. See `dmd.e2ir.toElemBin(BinExp be, int op)`
It does work with DMD 2.074. Anyone want to do a bisect to see which PR broke it?
@WalterBright created dlang/dmd pull request #10642 "fix Issue 20383 - [REG 2.084.z] illegal conversion from int[] to ubyt…" fixing this issue: - fix Issue 20383 - [REG 2.084.z] illegal conversion from int[] to ubyte[] is accepted https://github.com/dlang/dmd/pull/10642
dlang/dmd pull request #10642 "fix Issue 20383 - [REG 2.084.z] illegal conversion from int[] to ubyt…" was merged into stable: - ebeb86e36e2bdf6fbee065bed313cfc3cbdedb0d by Walter Bright: fix Issue 20383 - [REG 2.084.z] illegal conversion from int[] to ubyte[] is accepted https://github.com/dlang/dmd/pull/10642