alias fails to compile

Stefan Koch uplink.coder at googlemail.com
Mon Apr 22 08:17:14 UTC 2019


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.


More information about the Digitalmars-d-learn mailing list