Expected behavior
Unnamed structs inside of a parent struct should have all their members become members of the parent.
Actual Behavior
The structs are added to the tag_scope, but the parent struct is treated as if it has no members.
Code
struct tcphdr {
union {
struct { unsigned char th_x2:4; };
struct { unsigned short res1:4; };
};
};
<stdin>:3:36: warning: bitfields are not implemented and will be ignored
<stdin>:3:41: warning: declaration does not declare anything
<stdin>:4:36: warning: bitfields are not implemented and will be ignored
<stdin>:4:41: warning: declaration does not declare anything
<stdin>:5:7: warning: declaration does not declare anything
<stdin>:5:6: error: invalid program: cannot have empty struct
<stdin>:6:2: error: invalid program: cannot have empty struct
5 warnings and 2 errors generated
6.7.2.1 Structure and union specifiers, paragraph 13:
An unnamed member whose type specifier is a structure specifier with no tag is called an anonymous structure; an unnamed member whose type specifier is a union specifier with no tag is called an anonymous union. The members of an anonymous structure or union are considered to be members of the containing structure or union. This applies recursively if the containing structure or union is also anonymous.
Expected behavior Unnamed structs inside of a parent struct should have all their members become members of the parent.
Actual Behavior The structs are added to the tag_scope, but the parent struct is treated as if it has no members.
Code
6.7.2.1 Structure and union specifiers, paragraph 13: