[Issue 6844] New: Reinterpret cast of static to dynamic array doesn't work in safe code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 23 06:55:48 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6844

           Summary: Reinterpret cast of static to dynamic array doesn't
                    work in safe code
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: pszturmaj at tlen.pl


--- Comment #0 from Piotr Szturmaj <pszturmaj at tlen.pl> 2011-10-23 06:54:44 PDT ---
void main() @safe
{
    long[2] a;
    auto b = cast(ubyte[])a; // error
    auto c = cast(ubyte[])cast(long[])a; // works
}

main.d(4): Error: cast from long[2u] to ubyte[] not allowed in safe code

Without @safe mode there's no error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list