D - BUG? Unions with inner structs
- Sark7 (15/15) Feb 29 2004 The program
- Stewart Gordon (10/27) Mar 01 2004 A bug that I've been about to report for a while, but you got there firs...
The program
union U
{
struct { int a; }
struct { int b; }
}
void main()
{
printf("%d %d", U.a.offset, U.b.offset);
}
outputs:
0 4
It is a bug or strange D feature?
--
Sark7
Feb 29 2004
Sark7 wrote:
The program
union U
{
struct { int a; }
struct { int b; }
}
void main()
{
printf("%d %d", U.a.offset, U.b.offset);
}
outputs:
0 4
It is a bug or strange D feature?
A bug that I've been about to report for a while, but you got there first.
I found that it only happens with an anonymous inner struct - a
predefined struct seems to work fine. It works if there is only one
inner struct and it is put at the end (IIRC) of the union definition.
Stewart.
--
My e-mail is valid but not my primary mailbox, aside from its being the
unfortunate victim of intensive mail-bombing at the moment. Please keep
replies on the 'group where everyone may benefit.
Mar 01 2004








Stewart Gordon <smjg_1998 yahoo.com>