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

           Summary: typeof(null) can be casted to aggregate type if
                    .sizeof equals size of pointer
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2013-04-08 
07:42:22 PDT ---
struct S1
{
    int x;
}

struct S2
{
    int x;
    byte b;
}

void main()
{
    static assert(S1.sizeof == typeof(null).sizeof);
    auto s1 = cast(S1)null;  // compiles, should not

    static assert(S2.sizeof != typeof(null).sizeof);
    auto s2 = cast(S2)null;  // NG, as it should
}

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

Reply via email to