Bug 12502 – Some static array casts incorrectly rejected in safe code
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-01T04:10:00Z
Last change time
2017-07-19T17:38:59Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg
Comments
Comment #0 by verylonglogin.reg — 2014-04-01T04:10:00Z
This code should compile:
---
void f() @safe
{
const char[1] arr;
auto a1 = cast(const(ubyte)[]) arr[]; // ok
auto a2 = cast(const(char) []) arr; // ok
auto a3 = cast(const(ubyte)[]) arr; // Error: cast from const(char[1]) to const(ubyte)[] not allowed in safe code
}
---
Same as issue 11383 but for static arrays.