[Issue 13775] New: Broken explicit casting of dynamic array slices of known size to static array of different type

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Nov 25 06:58:53 PST 2014


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

          Issue ID: 13775
           Summary: Broken explicit casting of dynamic array slices of
                    known size to static array of different type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice, rejects-valid
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: verylonglogin.reg at gmail.com

This code used to compile:
---
void main()
{
    ubyte[4] ubytes;
    byte[2] bytes = cast(byte[2]) ubytes[0 .. 2];
}
---
main.d(4): Error: e2ir: cannot cast ubytes[0..2] of type ubyte[] to type
byte[2]
---

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?

--


More information about the Digitalmars-d-bugs mailing list