[fpc-devel] Fatal: Internal error 200111022

Michael Van Canneyt michael at freepascal.org
Wed Oct 20 13:22:02 CEST 2010


Hello,

Which 'Count' should the compiler select ? I suspect TSub.Count ?

I think we should prohibit this dubious construct in ObjFC mode.
(but try to be delphi compatible in Delphi mode)

Michael.

On Wed, 20 Oct 2010, Birger Jansen wrote:

> I'm not sure if this is the correct way to report this, please correct me if I should report in another way.
>
> I found an old conversation between Leonardo and Florian about the Fatail internal error 200111022. The thread concluded that they could not reproduce the error.
>
> I got this error while converting a large project from Delphi to FPC. It turns out that a base class has a property Count, and a derived class has a function with the same name Count. This will compile, untill you call the property or function Count.
>
> I created an example that should explain it. Uncomment the marked line to get the fatal internal error:
>
> program project1;
>
> {$mode objfpc}{$H+}
>
> uses
>  {$IFDEF UNIX}{$IFDEF UseCThreads}
>  cthreads,
>  {$ENDIF}{$ENDIF}
>  Classes;
>
> type
>
>  TBase = class
>  private
>    function GetCount: Integer;
>  public
>    property Count: Integer read GetCount;
>  end;
>
>  TSub = class(TBase)
>  public
>    function Count: Integer; overload;
>  end;
>
> function TSub.Count: Integer;
> begin
>  Result := 0;
> end;
>
> { TBase }
>
> function TBase.GetCount: Integer;
> begin
>  Result := 0;
> end;
>
> var
>  MySub: TSub;
>  i : Integer;
> begin
>  MySub := TSub.Create;
> // uncomment the next line for Fatal Internal error 200111022:
> //  for i := 0 to MySub.Count do begin end;
> end.
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>



More information about the fpc-devel mailing list