[fpc-devel] Debug compiler

Ondrej Pokorny lazarus at kluug.net
Mon Nov 2 20:47:44 CET 2015


On 02.11.2015 20:08, Sven Barth wrote:
> It's not a general compiler bug, but only in relationship with helpers 
> (I can't trigger it if I have a class constructed that way without a 
> helper). 

It is a general compiler bug. Not even related to a for-in or anything else.
See:

*program arraypropbug;**
**
**uses**
**  sysutils;**
**
**type**
**  TObj = class**
**  public**
**    function GetS(Index: Integer): string; overload;**
**    function GetS(Index1, Index2: Integer): Double; overload;**
**    property S[Index: Integer]: string read GetS;**
**  end;**
**
**{ TObj }**
**
**function TObj.GetS(Index1, Index2: Integer): Double;**
**begin**
**  Result := Index1 / Index2;**
**end;**
**
**function TObj.GetS(Index: Integer): string;**
**begin**
**  Result := IntToStr(Index);**
**end;**
**
**var**
**  o: TObj;**
**  d: Double;**
**begin**
**  o := TObj.Create;**
**  d := o.S[10, 3]; // !!!**
**  Writeln(d);**
**end.**
*
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20151102/691c1379/attachment.html>


More information about the fpc-devel mailing list