Report an error for dual commas at end of struct/union initializer.

This covers things like:

struct {int a,b;} u = {1,2,,};
This commit is contained in:
Stephen Heumann 2022-11-30 19:07:38 -06:00
parent c1a188aa95
commit 8ad58b0de7
1 changed files with 9 additions and 3 deletions

View File

@ -2697,9 +2697,15 @@ var
end; {else}
if ((ip = nil) or (ip^.itype^.size = 0)) and not braces then
goto 2;
{TODO need other code to disallow dual commas before right brace?}
if token.kind = commach then
NextToken
if token.kind = commach then begin
NextToken;
if token.kind = commach then
if ip = nil then
if braces then begin
Error(23);
errorFound := true;
end; {if}
end {if}
else if token.kind <> rbracech then
ip := nil;
end; {while}