October 23, 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@puremagic.com
        ReportedBy: pszturmaj@tlen.pl


--- Comment #0 from Piotr Szturmaj <pszturmaj@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: -------
December 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6844


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #1 from yebblies <yebblies@gmail.com> 2012-12-27 02:24:46 EST ---
Slicing a static array is equivalent to taking the address of a local variable, which is illegal in safed.  The second case works due to bug 8838.

*** This issue has been marked as a duplicate of issue 8838 ***

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