struct init property
Timon Gehr
timon.gehr at gmx.ch
Fri Aug 24 05:32:49 PDT 2012
On 08/24/2012 09:39 AM, nocide wrote:
> Am 23.08.2012 19:15, schrieb nocide:
>> struct has no default constructor and instances are initialized with the
>> init property.
>> Can I declare or override the init property for a custom defined struct?
>>
>
> Ok, the initializer forks fine for me,
> but I've encounterd following situation: (simplified code)
>
> // This compile fine
> struct Foo {
> union {
> struct {
> int a = 1, b = 2, c = 3, d = 4;
> }
> float[4] e;
> }
> }
>
>
> // but this doesn't compile
> struct Foo {
> union {
> struct {
> int a, b, c, d;
> }
> float[4] e = [ 1.0f, 2.0f, 3.0f, 4.0f ];
> }
> }
> Foo f; // Error: struct main.Foo overlapping initialization for struct
>
>
> Is this a bug?
>
>
Yes.
More information about the Digitalmars-d-learn
mailing list