January 29 [Issue 24361] New: casting string literal to static int array is broken | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24361 Issue ID: 24361 Summary: casting string literal to static int array is broken Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: ice Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: dkorpel@live.nl Found by Iain Buclaw: ``` void main() { ubyte[1] w = cast(ubyte[1]) "A"; // Passes uint[1] x = cast(uint[1]) "\xFF\xAA\xDD\xEE"; ulong[2] y = cast(ulong[2]) "\x11\x22\x33\x44\x55\x66\x77\x88\xAA\xBB\xCC\xDD\xEE\xFF\x00\x99"; } ``` These should be semantic errors, not backend errors. ``` Error: e2ir: cannot cast `"\xff\xaa\xdd\xee"` of type `string` to type `uint[1]` Error: e2ir: cannot cast `"\x11\"3DUfw\x88\xaa\xbb\xcc\xdd\xee\xff\0\x99"` of type `string` to type `ulong[2]` ``` -- |
Copyright © 1999-2021 by the D Language Foundation