View Issue Details

IDProjectCategoryView StatusLast Update
0036843FPCCompilerpublic2020-03-30 07:44
ReporterBBaz Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.0.4 
Summary0036843: impossible to override a virtual method of the base class and if the base class is also a generic type
Descriptionimpossible to override a virtual method of the base class and if the base class is also a generic type
Steps To Reproducef.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 InformationI 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
Tagsgenerics
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

BBaz

2020-03-29 22:20

reporter   ~0121757

verified not to work with Product Version=3.2.0-rc1

Issue History

Date Modified Username Field Change
2020-03-29 15:07 BBaz New Issue
2020-03-29 22:20 BBaz Note Added: 0121757
2020-03-30 07:44 Sven Barth Tag Attached: generics