diff --git a/Parser.pas b/Parser.pas index d9217d7..5e55afb 100644 --- a/Parser.pas +++ b/Parser.pas @@ -2512,7 +2512,15 @@ var variable^.bitdisp := bitdisp; variable^.bitsize := long(expressionValue).lsw; bitdisp := bitdisp+long(expressionValue).lsw; - end; {if} + tPtr := variable^.itype; + end {if} + else + tPtr := typeSpec; + if (tPtr^.kind <> scalarType) + or not (tPtr^.baseType in + [cgByte,cgUByte,cgWord,cgUWord,cgLong,cgULong]) + or (expressionValue > tPtr^.size*8) then + Error(115); end {if} else if variable <> nil then begin if bitdisp <> 0 then begin diff --git a/Scanner.pas b/Scanner.pas index 308e813..20000ca 100644 --- a/Scanner.pas +++ b/Scanner.pas @@ -595,6 +595,7 @@ if list or (numErr <> 0) then begin 112: msg := @'segment buffer overflow'; 113: msg := @'all parameters must have a name'; 114: msg := @'a function call was made to a non-function'; + 115: msg := @'illegal bit field declaration'; otherwise: Error(57); end; {case} writeln(msg^);