View Issue Details

IDProjectCategoryView StatusLast Update
0038771FPCCompilerpublic2021-04-18 18:26
ReporterRyan Joseph Assigned ToSven Barth  
Status closedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0038771: Specialization of virtual generic method crashes compiler
DescriptionThe following program gives "Compilation raised exception internally" due to the specialization of the virtual generic method.
Steps To Reproduce{$mode objfpc}

program test;
  TMyClass = class
    generic procedure DoThis<T>(msg: T);
    generic procedure DoThat<T>(msg: T); virtual;

generic procedure TMyClass.DoThis<T>(msg:T);
  specialize DoThat<T>(msg);

generic procedure TMyChild.DoThat<T>(msg: T);

TagsNo tags attached.
Fixed in Revision49228
Attached Files


Serge Anvarov

2021-04-17 20:06

reporter   ~0130434

I have on Win64 FPC 3.2.0:
project1.lpr(8,49) Error: Generic methods can not be virtual
project1.lpr(8,42) Error: Procedure directive "VIRTUAL" not allowed in implementation section
project1.lpr(16,19) Error: Identifier not found "TMyChild"
project1.lpr(16,19) Error: class identifier expected
project1.lpr(22) Fatal: There were 4 errors compiling module, stopping
Fatal: Compilation aborted

FPC 3.3.1 (revision 49080):
project1.lpr(8,49) Error: Generic methods can not be virtual
project1.lpr(8,49) Error: Compilation raised exception internally
Fatal: Compilation aborted
An unhandled exception occurred at $00000001000FF0FC:
EAccessViolation: Access violation

Ryan Joseph

2021-04-17 20:20

reporter   ~0130435

I made a typo with "TMyChild". Should be "TMyClass" also.

Sven Barth

2021-04-18 16:10

manager   ~0130441

Now the compiler does not crash anymore.

Please test and close if okay.

Issue History

Date Modified Username Field Change
2021-04-17 19:14 Ryan Joseph New Issue
2021-04-17 20:06 Serge Anvarov Note Added: 0130434
2021-04-17 20:20 Ryan Joseph Note Added: 0130435
2021-04-18 16:10 Sven Barth Assigned To => Sven Barth
2021-04-18 16:10 Sven Barth Status new => resolved
2021-04-18 16:10 Sven Barth Resolution open => fixed
2021-04-18 16:10 Sven Barth Fixed in Version => 3.3.1
2021-04-18 16:10 Sven Barth Fixed in Revision => 49228
2021-04-18 16:10 Sven Barth FPCTarget => -
2021-04-18 16:10 Sven Barth Note Added: 0130441
2021-04-18 18:26 Ryan Joseph Status resolved => closed