[Issue 5380] New: Subtyping with "alias this" doesn't mix with regular inheritance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 27 04:01:14 PST 2010


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

           Summary: Subtyping with "alias this" doesn't mix with regular
                    inheritance
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            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> 2010-12-27 03:59:11 PST ---
class A
{
}

class B
{
    A a;
    alias a this;
}

class C : B
{
}

void main()
{
    A a = new C; // error
}

Error: cannot implicitly convert expression (new C) of type test.C to test.A

Since C is a subtype of B (via inheritance) and B is a subtype of A (via "alias
this"), C should be implicitly convertible to A.

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