Skip to content

aliasing for fields does not work #20610

Closed
@WalterBright

Description

@WalterBright
struct T {
    int k,i = 2;
}

struct S {
    int x;
    T t;
    alias ti = t.i;
}

int main() {
    T t = T(1, 2);
    S s;
    assert(s.ti == 2); // Error: accessing non-static variable `i` requires an instance of `T`
    return 0;
}

s.ti should be equivalent to s.t.i

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions