Cannot declare "LongInt = AnsiString" comparison operator
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
When I want to declare "LongInt = AnsiString" comparison operator, the compiler tells me "Impossible operator overload" although it is documented to work.
http://lazarus-ccr.sourceforge.net/fpcdoc/ref/refse67.html#x156-16300012.5 :
&LtPos;i>The comparision operator can be overloaded to compare &LtPos;b>two different types&LtPos;/b> or to compare two equal types that are not basic types.&LtPos;/i>
Steps to reproduce:
Compile the following program:
program project1;
{$mode objfpc}{$H+}
{$modeswitch advancedrecords}
operator = (z1: LongInt; z2 : ansistring) b : boolean;
begin
b := false;
end;
var
i: longint;
s: string;
begin
writeln(i = s);
readln;
end.
Mantis conversion info:
- Mantis ID: 29460
- Version: 3.1.1
- Fixed in version: 3.3.1
- Fixed in revision: 43709 (#2f374a37)