impossible to override a virtual method of the base class and if the base class is also a generic type
Original Reporter info from Mantis: BBaz @basile.b
-
Reporter name:
Original Reporter info from Mantis: BBaz @basile.b
- Reporter name:
Description:
impossible to override a virtual method of the base class and if the base class is also a generic type
Steps to reproduce:
f.pas
---
{$mode objfpc}
program f;
type
TBase = class
procedure func(); virtual;
end;
TDerived1 = class(TBase)
end;
TDerived2 = class(TBase)
end;
generic THelper<T:TBase> = class(T)
procedure func(); override;
end;
THelperFor1 = class(specialize THelper<TDerived1>);
THelperFor2 = class(specialize THelper<TDerived2>);
procedure TBase.func(); begin end;
procedure THelper.func(); begin end;
begin
end.
---
--- $ fpc f.pas ---
gives:
f.pas(17,15) Error: There is no method in an ancestor class to be overridden: "func;"
f.pas(30) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Additional information:
I dont know if i use the trunk. FPC was build from source using the link of this page: https://www.freepascal.org/develop.html (ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/source/fpc.zip) but -help indicates that it's 3.0.4
Mantis conversion info:
- Mantis ID: 36843
- Version: 3.0.4