From ab51fc228d1cb7a777e32abebc6f904e0098f9d6 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Fri, 1 Jan 2016 16:23:30 -0600 Subject: [PATCH] Allow string and double constants to appear within the operands of sizeof in a constant expression. This fixes one of the problems in the compca08.c test case. --- Expression.pas | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Expression.pas b/Expression.pas index de23d81..055ebed 100644 --- a/Expression.pas +++ b/Expression.pas @@ -556,7 +556,7 @@ function ExpressionTree (kind: expressionKind; stopSym: tokenSet): tokenPtr; { an expression when evaluating a function } { parameter list. } -label 1,2; +label 1,2,3; var done,done2: boolean; {for loop termination} @@ -1541,9 +1541,18 @@ if token.kind in startExpression then begin stack := sp; if kind in [preprocessorExpression,arrayExpression] then if token.kind in [stringconst,doubleconst] then begin + if kind = arrayExpression then begin + op := opStack; + while op <> nil do begin + if op^.token.kind = sizeofsy then + goto 3; + op := op^.next; + end; {while} + end; {if} Error(41); errorFound := true; end; {if} +3: NextToken; ComplexTerm; end; {else}