www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13775] New: Broken explicit casting of dynamic array slices

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 puremagic.com
          Reporter: verylonglogin.reg 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?

--
Nov 25 2014