[Issue 10843] New: Combinatorial problem of struct & alias this & null

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 17 22:03:20 PDT 2013


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

           Summary: Combinatorial problem of struct & alias this & null
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: zan77137 at nifty.com


--- Comment #0 from SHOO <zan77137 at nifty.com> 2013-08-17 22:03:19 PDT ---
These tree samples don't work:
------------------
unittest
{
    static struct HANDLE
    {
        void* h;
        alias h this;
    }

    //HANDLE a = null;             // NG
    HANDLE a;
    a = null;                      // OK
}

unittest
{
    static struct HANDLE
    {
        void* h;
        alias h this;
        this(void* h) { this.h = h; }
    }
    HANDLE a = null;               // OK
    static void foo(HANDLE h){}
    //foo(null);                   // NG
}

unittest
{
    static struct HANDLE
    {
        void* h;
        alias h this;
        this(void* h) { this.h = h; }
    }
    static struct WSAEVENT
    {
        HANDLE h;
        alias h this;
        this(HANDLE h) { this.h = h; }
    }
    auto a = cast(HANDLE)null;     // OK
    //auto b = cast(WSAEVENT)null; // NG
}

-- 
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