https://issues.dlang.org/show_bug.cgi?id=13775
Kenji Hara <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull Summary|Broken explicit casting of |[REG2.067a] Broken explicit |dynamic array slices of |casting of dynamic array |known size to static array |slices of known size to |of different type |static array of different | |type --- Comment #9 from Kenji Hara <[email protected]> --- (In reply to Denis Shelomovskij from comment #0) > In case it was an accept-invalid bug, what is the reason to disallow the > feature and break user code without any deprecation message and with such > unpleasant minor ICE message? The expression cast(byte[2]) ubytes[0..2] would mean a combination of - an implicit conversion T[] to T[dim] on a slice expression with CT-known boundaries - reinterpret cast T[n] to U[m] When I implemented issue 3652, I didn't think about the case. So the code had been just accidentally accepted and and fortunately worked as you intended. Then, I made the code invalid in my pull/3984 to fix some wrong-code bug. ubyte[4] ubytes; byte[3] bytes = cast(byte[3]) ubytes[2 .. 4]; // This code had been wrongly accepted before the pull/3984. Finally, following PR will accept such reinterpret cast only when the cast is appropriate. https://github.com/D-Programming-Language/dmd/pull/4193 (In reply to Steven Schveighoffer from comment #4) > Is this really an ICE? Usually an ICE shows a DMD source line number where > the assert happened, or a seg fault. > > This looks more like a standard error message, although the "e2ir" is out of > place. > > I found the error message, it doesn't look like an ICE to me, just a bad > error message: > > https://github.com/D-Programming-Language/dmd/blob/master/src/e2ir.c#L4428 > > Looking through history, that message has been that way for a long time. > > Clearly, it's a regression, and rejects-valid, but not ICE. >From historical reasons, some cast operations have been verified only by glue-layer. That's why sometimes 'e2ir' errors are reported for invalid cast operations. Essentially, all semantic errors should be handled by front-end layer. So I recognize it's a not-yet fixed compiler internal issue. --
