From debd0ccffc5cea4518ec6eb30f3f6a217a51d1b9 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Tue, 16 Mar 2021 18:20:22 -0500 Subject: [PATCH] Always allow the middle expression of a ? : expression to use the comma operator. This should be allowed, but it previously could lead to spurious errors in contexts like argument lists, where a comma would normally be expected to end the expression. The following example program demonstrated the problem: #include int main(void) { return abs(1 ? 2,-3 : 4); } --- Expression.pas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Expression.pas b/Expression.pas index 34c60a8..88e6cf4 100644 --- a/Expression.pas +++ b/Expression.pas @@ -2149,7 +2149,8 @@ if token.kind in startExpression then begin end; {case} if icp[token.kind] = notAnOperation then done := true {end of expression found...} - else if (token.kind in stopSym) and (parenCount = 0) then + else if (token.kind in stopSym) and (parenCount = 0) + and ((opStack = nil) or (opStack^.token.kind <> questionch)) then done := true else begin if not (kind in [normalExpression, autoInitializerExpression]) then