[Issue 19639] Initializing static array with slice enum of different length crashes the compiler

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 2 21:43:51 UTC 2019


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

--- Comment #2 from Neia Neutuladh <dhasenan at gmail.com> ---
For some reason, this is doing a reinterpret cast.

It isn't documented that you can do this kind of cast into a static array. It's
only mentioned for dynamic arrays to dynamic arrays.

The examples in the compiler source code (is that where we're keeping the spec
these days?) explicitly involve not keeping the same length.

Similar example:

---
void main()
{
  writeln(cast(wchar[64])"hi"c);
}
---

Expected output: some sort of error about "hi" not being long enough to fill a
wchar[64].

Actual output: 楨錀缳Ჰ鏌缳 ɱ荀Ű

--


More information about the Digitalmars-d-bugs mailing list