[Issue 9618] `alias this` is used insted of implicit upcasting of other `alias this` target

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 9 04:29:06 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=9618


Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |verylonglogin.reg at gmail.com
            Summary|DMD takes unnecessary route |`alias this` is used insted
                   |to alias this in certain    |of implicit upcasting of
                   |situations                  |other `alias this` target


--- Comment #1 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-11-09 15:29:02 MSK ---
Reduced testcase:
---
class C
{
    int val;
    alias val this;
}

struct S
{
    C c;
    alias c this;
}

void main()
{
    C c1 = S(); // ok
    Object c2 = S().c; // ok
    Object c3 = S(); // Error: e2ir: cannot cast (new C2).c.val of type int to
type main.Base
}
---

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


More information about the Digitalmars-d-bugs mailing list