diff --git a/Parser.pas b/Parser.pas index acad9b4..83c31f9 100644 --- a/Parser.pas +++ b/Parser.pas @@ -3091,7 +3091,11 @@ while token.kind in allowedTokens do begin Expression(arrayExpression,[commach,rbracech]); enumVal := long(expressionValue).lsw; if enumVal <> expressionValue then - Error(6); + Error(6) + else if enumVal < 0 then + if expressionType^.kind = scalarType then + if expressionType^.baseType in [cgULong,cgUQuad] then + Error(6); end; {if} tPtr^.eval := enumVal; {set the enumeration constant value} enumVal := enumVal+1; {inc the default enumeration value} diff --git a/cc.notes b/cc.notes index e2b8159..11d625c 100644 --- a/cc.notes +++ b/cc.notes @@ -1194,6 +1194,8 @@ int foo(int[42]); 156. The second subexpression of a ? : expression may use the comma operator, even in a context where commas would otherwise separate items (such as arguments to a function). For example, abs(1 ? 2,-3 : 4) is a valid call that passes one argument. Code like this was causing spurious errors, but now it is accepted. +157. An error was not reported if code tried to declare an enumeration constant with a value in the range 0xFFFF8000 to 0xFFFFFFFF. (Enumeration constants are limited to values representable as an int.) + -- Bugs from C 2.1.0 that have been fixed ----------------------------------- 1. In some situations, fread() reread the first 1K or so of the file.