January 22, 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.
January 23, 2012
On 01/23/2012 12:51 AM, Caligo wrote:
> 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.

structs are always default-constructible, and, as a tie-breaker, a function definition that has the exact number of arguments is considered a better match one that has to supply default-arguments to match. You could use a static opCall to make auto a = A!8() work.