[Issue 10996] Subtyping with "alias this" conflicts with private base type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 23 12:47:08 UTC 2018


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |INVALID

--- Comment #6 from RazvanN <razvan.nitu1305 at gmail.com> ---
Storage class modifiers are ignored for alias this. The alias this simply
forwards undefined lookups to the the aliased member. So the following code:

Bar b = new Bar();
b.a = 10;

is actually lowered to:

b._base.a = 10;

If you are in the same module as the declaration of Bar, that's fine.
Otherwise, you will get an error which is the correct behavior. See Walter's
comment on [1].

Closing as invalid.

[1] https://issues.dlang.org/show_bug.cgi?id=10692

--


More information about the Digitalmars-d-bugs mailing list