From 7fa74d11835036af3fc4df7dc37008cef1de02bd Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 19 Dec 2016 14:36:48 -0600 Subject: [PATCH] Allow floating literals that are immediately cast to integer types to appear in integer constant expressions. The C standards say these should be permitted. The following declaration shows an example: int a[(int)5.5]; --- Expression.pas | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Expression.pas b/Expression.pas index 5d3bada..1f05248 100644 --- a/Expression.pas +++ b/Expression.pas @@ -1562,6 +1562,13 @@ if token.kind in startExpression then begin if token.kind in [stringconst,doubleconst] then begin if kind = arrayExpression then begin op := opStack; + if token.kind = doubleconst then + if op <> nil then + if op^.token.kind = castoper then + if op^.casttype^.kind = scalarType then + if op^.casttype^.baseType in [cgByte,cgUByte, + cgWord,cgUWord,cgLong,cgULong] then + goto 3; while op <> nil do begin if op^.token.kind = sizeofsy then goto 3;