https://issues.dlang.org/show_bug.cgi?id=19032

Simen Kjaeraas <simen.kja...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kja...@gmail.com

--- Comment #1 from Simen Kjaeraas <simen.kja...@gmail.com> ---
Simplified:

class A {
    int n;
    alias n this;
}

class B : A {}

unittest {
    // Works when accessed through an A:
    static assert(__traits(compiles, cast(int)new A()));
    static assert(__traits(compiles, cast(int)cast(A)new B()));

    // Fails when accessed through a B:
    static assert(!__traits(compiles, cast(int)new B()));
}

OP also requires multiple alias this, which the documentation states is
currently unimplemented (issue 6083).

--

Reply via email to