mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-03-11 07:29:29 +00:00
Treat array types as compatible with corresponding pointer types in function prototypes.
This permits code like the following to compile, as it should: int foo(int*); int foo(int[]); int foo(int[42]);
This commit is contained in:
parent
8ca3d5f4f0
commit
5321ef2f84
13
Parser.pas
13
Parser.pas
@ -1596,7 +1596,18 @@ if tPtr^.kind = functionType then begin {declare the identifier}
|
||||
pt2 := p2^.parameterType
|
||||
else
|
||||
pt2 := p2^.parameter^.itype;
|
||||
if not CompTypes(pt1, pt2) then begin
|
||||
compatible := false;
|
||||
if CompTypes(pt1, pt2) then
|
||||
compatible := true
|
||||
else begin
|
||||
tk1 := pt1^.kind;
|
||||
tk2 := pt2^.kind;
|
||||
if (tk1 = arrayType) and (tk2 = pointerType) then
|
||||
compatible := CompTypes(pt1^.aType, pt2^.pType)
|
||||
else if (tk1 = pointerType) and (tk2 = arrayType) then
|
||||
compatible := CompTypes(pt1^.pType, pt2^.aType)
|
||||
end; {else}
|
||||
if not compatible then begin
|
||||
Error(47);
|
||||
goto 1;
|
||||
end; {if}
|
||||
|
Loading…
x
Reference in New Issue
Block a user