Support designated initialization of anonymous member fields.

As noted previously, there is some ambiguity in the standards about how anonymous structs/unions participate in initialization. ORCA/C follows the model that they do participate as structs or unions, and designated initialization of them is implemented accordingly.

This currently has a slight issue in that extra copies of the anonymous member field name will be printed in #pragma expand output.
This commit is contained in:
Stephen Heumann 2022-11-28 20:55:47 -06:00
parent 4621336c3b
commit 39250629bd

View File

@ -2627,8 +2627,15 @@ var
ip := ip^.next;
if ip = nil then
Error(81);
NextToken;
{TODO if ip is an anonymous member field ...}
if ip^.anonMemberField then begin
PutBackToken(token, false);
token.kind := dotch;
token.class := reservedSymbol;
token.isDigraph := false;
ip := ip^.anonMember;
end {if}
else
NextToken;
if token.kind in [dotch,lbrackch] then
hasNestedDesignator := true
else