On Monday, 22 April 2019 at 08:02:06 UTC, Arun Chandrasekaran wrote:
What am I doing wrong here?

struct A
{
    union B
    {
        int bb;
    }
    B b;
    alias aa = B.bb;
}

void main()
{
    A a = A();
    // a.b.bb = 4; // works
    a.aa = 4; // fails
}


https://run.dlang.io/is/kXaVy2

You are aliasing B.init.bb;
You should try aliasing b.bb;

though I am not sure in that'll work since alias is really only meant for symbols.

Reply via email to