* nil =/<> dyn. array is a valid expression, so isbinaryoperatoroverloadable needs to take care of it, resolves #39933

(cherry picked from commit 2396b36c21)
This commit is contained in:
florian 2022-10-03 10:26:09 +02:00
parent 28865ab4f8
commit 19c2e948b9
2 changed files with 15 additions and 1 deletions

View File

@ -459,7 +459,8 @@ implementation
) or
(
(lt=niln) and
(rd.typ in [procvardef,procdef,classrefdef]) and
((rd.typ in [procvardef,procdef,classrefdef]) or
(is_dynamic_array(rd))) and
(treetyp in identity_operators)
) or
(

13
tests/webtbs/tw39933.pp Normal file
View File

@ -0,0 +1,13 @@
{ %norun }
program Project1;
{$mode delphi}
var a: TArray<integer>;
begin
writeln ( a = nil );
writeln ( a <> nil );
writeln ( nil = a ); // project1.lpr(10,17) Error: Operator is not overloaded: "Pointer" = "TArray$1$crc9F312717"
writeln ( nil <> a ); // project1.lpr(11,17) Error: Operator is not overloaded: "Pointer" = "TArray$1$crc9F312717"
end.