On Wednesday, 13 July 2016 at 14:01:25 UTC, Adam D. Ruppe wrote:
Yes, your code is legal.

What isn't legal is using some type that isn't there at runtime, like

union A {
   int[] a;
   char[] b;
}

A u;

u.a = [1,2];

u.b.length


The compiler will let you do it, but being a union, it will show length == 1 because it was set to an int[], but that's not really correct for a char[].


But the way you did it, initializing to the proper type before accessing it, is allowed.

Thank you!

Reply via email to