[Lazarus] "global" operator overloading

Xiangrong Fang xrfang at gmail.com
Tue Feb 26 15:37:04 CET 2013


Then, I wish to see 2.8 released :-D

thanks.

2013/2/26 Sven Barth <pascaldragon at googlemail.com>

> On 26.02.2013 15:30, Xiangrong Fang wrote:
>
>> Hi Sven,
>>
>> My code below:
>>
>> ==============================**=================
>> program project1;
>> {$mode objfpc}{$H+}
>> {$MODESWITCH advancedrecords}
>>
>> uses Classes;
>> type
>>    TMyStringList = record
>>      StringList: TStringList;
>>      class operator <(s1, s2: TMyStringList): Boolean;
>>    end;
>>
>> class operator TMyStringList.<(s1, s2: TMyStringList): Boolean;
>> begin
>>    Result := s1.StringList.Count < s2.StringList.Count;
>> end;
>>
>> begin
>> end.
>> ==============================**=================
>>
>> generated these errors:
>>
>> project1.lpr(9,20) Error: It is not possible to overload this operator.
>> Related overloadable operators (if any) are:
>> project1.lpr(9,21) Error: It is not possible to overload this operator.
>> Related overloadable operators (if any) are:
>> project1.lpr(9,53) Error: Impossible operator overload
>> project1.lpr(12,31) Error: method identifier expected
>> project1.lpr(1,1) Fatal: Compilation aborted
>>
>> I am using Lazarus 1.0.6/FPC2.6.0-6  on Linux Mint 14/x86_64.
>>
>
> Hmm... 2.6.0 seems to indeed have problems there. I did not test 2.6.2 (I
> don't have it installed yet), but 2.7.1 works without problems.
>
>
> Regards,
> Sven
>
>
> --
> ______________________________**_________________
> Lazarus mailing list
> Lazarus at lists.lazarus.**freepascal.org<Lazarus at lists.lazarus.freepascal.org>
> http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130226/97d80c72/attachment-0003.html>


More information about the Lazarus mailing list