www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11333] New: Cannot subtype 0-tuple with "alias this"

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

           Summary: Cannot subtype 0-tuple with "alias this"
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: samukha voliacable.com



PDT ---
template id(a...)
{
    alias id = a;
}

struct Unit
{
    enum value = Unit.init.tupleof;
    alias value this;
}

void foo()
{   
}

void main()
{   
    id!() unit;
    unit = unit; // ok  
    foo(unit); // ok

    unit = Unit.value; // ok
    foo(Unit.value); // ok

    Unit unit2;
    unit = unit2; // Segmentation fault (core dumped)
    foo(unit2); // Error: function test.foo () is not callable using argument
types (Unit)
}

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