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

           Summary: Alias this takes ownership of explicit cast
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: jesse.k.phillip...@gmail.com


--- Comment #0 from Jesse Phillips <jesse.k.phillip...@gmail.com> 2012-04-29 
07:41:14 PDT ---
When attempting to downcast a class which uses alias this, the operation fails
because the cast is applied to the item aliased.

I think the semantics should be to attempt an implicit cast (alias this), then
a cast of the top class, afterwards the alias this item can be casted.

test.d(3): Error: e2ir: cannot cast a.val of type int to type test.B

void main () {
    A a = new B();
    B b = cast(B) a;
}

class A {
    int val;
    alias val this;
}
class B : A {}

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

Reply via email to