From 8ad58b0de7ad36364c00250fd280086881707da7 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Wed, 30 Nov 2022 19:07:38 -0600 Subject: [PATCH] Report an error for dual commas at end of struct/union initializer. This covers things like: struct {int a,b;} u = {1,2,,}; --- Parser.pas | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Parser.pas b/Parser.pas index 27daaeb..bf680d5 100644 --- a/Parser.pas +++ b/Parser.pas @@ -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}