mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-02-11 22:30:49 +00:00
Give an error if the element type of an array type is an incomplete or function type.
This commit is contained in:
parent
96f04b168e
commit
c55acd1150
@ -3024,12 +3024,18 @@ var
|
||||
tp := v^.itype; {initialize the type pointer}
|
||||
while tp <> nil do begin {check all types}
|
||||
if tp^.kind = arrayType then {if it's an array with an unspecified }
|
||||
begin
|
||||
if tp^.elements = 0 then { size and an unspecified size is not }
|
||||
if not firstVariable then { allowed here, flag an error. }
|
||||
begin
|
||||
Error(49);
|
||||
goto 1;
|
||||
end; {if}
|
||||
if tp^.aType^.size = 0 then begin
|
||||
Error(123);
|
||||
goto 1;
|
||||
end; {if}
|
||||
end; {if}
|
||||
firstVariable := false; {unspecified sizes are only allowed in }
|
||||
{ the first subscript }
|
||||
case tp^.kind of {next type...}
|
||||
|
@ -610,6 +610,7 @@ if list or (numErr <> 0) then begin
|
||||
120: msg := @'non-static inline functions are not supported';
|
||||
121: msg := @'invalid digit for binary constant';
|
||||
122: msg := @'arithmetic is not allowed on a pointer to an incomplete or function type';
|
||||
123: msg := @'array element type may not be an incomplete or function type';
|
||||
otherwise: Error(57);
|
||||
end; {case}
|
||||
writeln(msg^);
|
||||
|
Loading…
x
Reference in New Issue
Block a user