no-argument constructor: is this a bug?

2012-01-22 Thread Caligo
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.

Re: no-argument constructor: is this a bug?

2012-01-22 Thread Timon Gehr
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

Re: no-argument constructor: is this a bug?

2012-01-22 Thread Jonathan M Davis
On Sunday, January 22, 2012 17:51:36 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