mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 23:07:55 +02:00
* partly revert 8cd6606970
, resolves #41052
(cherry picked from commit 854d4e6f4a5b53040160f8921d0089167f6b00be)
This commit is contained in:
parent
24faf6e0f1
commit
d147488133
@ -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
26
tests/webtbs/tw41052.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user