mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-02-08 18:30:35 +00:00
Give an appropriate error for an illegal operator in a constant expression.
This was being reported as an "illegal type cast".
This commit is contained in:
parent
e4515e580a
commit
2b9d332580
@ -2163,7 +2163,7 @@ if token.kind in startExpression then begin
|
|||||||
and (token.kind = sizeofsy))
|
and (token.kind = sizeofsy))
|
||||||
or ((kind <> initializerExpression)
|
or ((kind <> initializerExpression)
|
||||||
and (token.kind = uand)) then begin
|
and (token.kind = uand)) then begin
|
||||||
Error(40);
|
Error(161);
|
||||||
errorFound := true;
|
errorFound := true;
|
||||||
end; {if}
|
end; {if}
|
||||||
if token.kind in {make sure we get what we want}
|
if token.kind in {make sure we get what we want}
|
||||||
|
@ -714,6 +714,7 @@ if list or (numErr <> 0) then begin
|
|||||||
158: msg := @'_Generic expression includes two compatible types';
|
158: msg := @'_Generic expression includes two compatible types';
|
||||||
159: msg := @'_Generic expression includes multiple default cases';
|
159: msg := @'_Generic expression includes multiple default cases';
|
||||||
160: msg := @'no matching association in _Generic expression';
|
160: msg := @'no matching association in _Generic expression';
|
||||||
|
161: msg := @'illegal operator in a constant expression';
|
||||||
otherwise: Error(57);
|
otherwise: Error(57);
|
||||||
end; {case}
|
end; {case}
|
||||||
writeln(msg^);
|
writeln(msg^);
|
||||||
|
2
cc.notes
2
cc.notes
@ -1196,6 +1196,8 @@ int foo(int[42]);
|
|||||||
|
|
||||||
157. An error was not reported if code tried to define an enumeration constant with a value in the range 0xFFFF8000 to 0xFFFFFFFF. (Enumeration constants are limited to values representable as an int.)
|
157. An error was not reported if code tried to define an enumeration constant with a value in the range 0xFFFF8000 to 0xFFFFFFFF. (Enumeration constants are limited to values representable as an int.)
|
||||||
|
|
||||||
|
158. An "illegal type cast" error would be reported when an illegal operator was used in a constant expression. An appropriate error message is now produced.
|
||||||
|
|
||||||
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
||||||
|
|
||||||
1. In some situations, fread() reread the first 1K or so of the file.
|
1. In some situations, fread() reread the first 1K or so of the file.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user