www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - alias this and anonymous unions

example code:
struct vec3(T)
{
      union
      {
         struct { T x; T y; Tz; }
         T[3] packed;
        }
       alias packed this;
}

void test ()
{
    vec3!int v;
    v = [1,1,1];
}
produces

Deprecation: Cannot use alias this to partially initialize variable

does it make sense to offer this depreciation on a member of a union
which is the same size as the union (IE the largest member)?
May 24 2020