* partly revert 8cd6606970, resolves

(cherry picked from commit 854d4e6f4a5b53040160f8921d0089167f6b00be)
This commit is contained in:
florian 2024-12-23 14:26:26 +01:00
parent 24faf6e0f1
commit d147488133
2 changed files with 28 additions and 2 deletions
compiler
tests/webtbs

View File

@ -2825,9 +2825,9 @@ const
case nodetype of
equaln,unequaln :
begin
if is_voidpointer(right.resultdef) and (left.nodetype<>niln) then
if is_voidpointer(right.resultdef) then
inserttypeconv(right,left.resultdef)
else if is_voidpointer(left.resultdef) and (right.nodetype<>niln) then
else if is_voidpointer(left.resultdef) then
inserttypeconv(left,right.resultdef)
else if not(equal_defs(ld,rd)) then
IncompatibleTypes(ld,rd);

26
tests/webtbs/tw41052.pp Normal file
View File

@ -0,0 +1,26 @@
program project2;
{$mode objfpc}
{$inline on}
function Func1(S: PAnsiChar): SizeUInt;
begin
Result := 0;
end;
function Func2(S: PAnsiChar): SizeUInt; inline;
begin
Result := Func1(S);
if S <> nil then S[Result] := #0;
end;
function Func3(S: PAnsiChar): SizeUInt; inline;
begin
Result := Func1(S);
if Assigned(S) then S[Result] := #0;
end;
begin
Func2(nil); // <-- OK
Func3(nil); // <-- Error: Incompatible types: got "PAnsiChar" expected "Pointer"
end.