2.085-beta / nightly regression uda inside union breaks default initialization

Juraj Mojzis zero at vec4.xyz
Sat Feb 16 13:32:12 UTC 2019


Hi,
i would like to report an issue here, as I'm unable to create an 
account on Bugzilla.

---
import std.stdio;
struct V4_UDA(T) {
     enum N = 4;

     union {
         @("BRAKE_ME") T[N] v = 0;
         struct { T x, y, z, w; }
     }

     this(T vx, T vy, T vz, T vw) {
         x = vx; y = vy; z = vz; w = vw;
     }
}


alias v4_broken = V4_UDA!(float);

struct OMG {
     v4_broken broken = v4_broken(1.0f, 2.0f, 3.0f, 4.0f);
}

void main()
{
     OMG omg;
     writeln(omg.broken.v, "!!!");
}
---

prints:
[0, 0, 0, 0]!!!


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





More information about the Digitalmars-d mailing list