[Bug 44] New: forward referenced anonymous union in struct size discrepancy

Thomas Kuehne thomas-dloop at kuehne.cn
Mon Mar 13 00:19:29 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail at puremagic.com schrieb am 2006-03-12:
> If B is declared before A, or the union in A is named (and an instance added)
> then the sizeof A is 12 as it should be. In the example below it is 8.
>
> struct A {
>         int a;
>         union {
>                 int c;
>                 B b;
>         }
> }
>
> struct B {
>         int b1;
>         int b2;
> }

Added to DStress as
http://dstress.kuehne.cn/run/u/union_16_A.d
http://dstress.kuehne.cn/run/u/union_16_B.d
http://dstress.kuehne.cn/run/u/union_16_C.d
http://dstress.kuehne.cn/run/u/union_16_D.d
http://dstress.kuehne.cn/run/u/union_16_E.d
http://dstress.kuehne.cn/run/u/union_16_F.d
http://dstress.kuehne.cn/run/u/union_16_G.d
http://dstress.kuehne.cn/run/u/union_16_H.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFEFS7O3w+/yD4P9tIRAozZAJwKACUIQmALriijrOAxWHfi7NdvzgCbBzOg
sJSwMb7zHxyIEEsqBkcE8qk=
=WLwB
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list