struct default constructor, unions and bizaro behavior.

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 10 19:32:53 PST 2014


On 12/10/2014 1:57 PM, deadalnix wrote:
> struct S {
>       union {
>           T1 t1;
>           T2 t2;
>       }
>
>       T3 t3;
> }
>
> T1 a1;
> T3 a3;
> S(a1, a3);
>
> This is erroring because t1 is set twice. It turns out that the
> second parameter of the struct map to t2 rather than t3.
>
> This behavior do not make any sense, ever. Why is that the
> default ?

Please file a bug report.


More information about the Digitalmars-d mailing list