View Issue Details

IDProjectCategoryView StatusLast Update
0038771FPCCompilerpublic2021-04-18 18:26
ReporterRyan Joseph Assigned ToSven Barth  
PrioritynormalSeverityminorReproducibilityalways
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;
  
type
  TMyClass = class
    generic procedure DoThis<T>(msg: T);
    generic procedure DoThat<T>(msg: T); virtual;
  end;

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

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

begin
end.
TagsNo tags attached.
Fixed in Revision49228
FPCOldBugId
FPCTarget-
Attached Files

Activities

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
  $00000001000FF0FC
  $00000001001016CE
  $0000000100101E9B
  $00000001000C0CA0
  $0000000100149E64
  $000000010014931B
  $00000001001490AC
  $000000010014985A
  $0000000100148CA4
  $0000000100120A8B
  $000000010010414D
  $000000010010422B
  $00000001001042C1
  $00000001001042DF
  $0000000100190ECA
  $00000001001978BF
  $0000000100194DF3

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