no-argument constructor: is this a bug?

Caligo iteronvexor at gmail.com
Sun Jan 22 15:51:36 PST 2012


struct A(uint samples){

  float[samples] _data = void;

  this(float val = 0.0f){ fill(_data[], val); }
}


  auto a = A!8();

a._data is filled with garbage instead of zeros because the
no-argument constructor is called instead of the one that I've
defined.


More information about the Digitalmars-d-learn mailing list