[Issue 13189] `alias this` is not transitive

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 4 19:38:12 UTC 2020


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

John Hall <john.michael.hall at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.michael.hall at gmail.com

--- Comment #1 from John Hall <john.michael.hall at gmail.com> ---
When I compile below I get the error: "onlineapp.d(17): Error: no property x
for type onlineapp.T"

struct S {
    int x;
    int y;
}

struct T {
    S s;
    alias s this;
}

static assert(is(typeof(T.init.x)));
static assert(is(typeof(T.init.y)));

struct U {
    T t;
    alias x = t.x; // <-- FAIL
    alias y = t.s.x; // <-- OK
}

void main() {
}

--


More information about the Digitalmars-d-bugs mailing list