[Issue 11333] New: Cannot subtype 0-tuple with "alias this"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 23 11:57:59 PDT 2013


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 at puremagic.com
        ReportedBy: samukha at voliacable.com


--- Comment #0 from Max Samukha <samukha at voliacable.com> 2013-10-23 11:57:57 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: -------


More information about the Digitalmars-d-bugs mailing list