View Issue Details

IDProjectCategoryView StatusLast Update
0037707FPCCompilerpublic2020-09-07 17:09
ReporterBlackShark Assigned To 
Status newResolutionopen 
Product Version3.2.0 
Summary0037707: Generics
DescriptionError: Can't determine which overloaded function to call
Steps To ReproduceCompile project1.lpr
Fixed in Revision
Attached Files



2020-09-05 13:01

reporter (431 bytes)


2020-09-07 14:15

reporter   ~0125424

Last edited: 2020-09-07 14:16

View 2 revisions

function Find(const Key: K; out Value: V): boolean; overload;
function Find(const Key: K; out Item: TBucket): boolean; overload;

Which function to choose if type V is TBucket?

Bart Broersma

2020-09-07 14:36

reporter   ~0125426

Type <V> in principle can also be TBucket.

Serge Anvarov

2020-09-07 17:09

reporter   ~0125428

1. If change to "THashTable<K; V: TObject> = class..." and "Table: THashTable<string, TObject>;", the compiler understands that type V cannot be a TBucket type and and compile successfully.
2. But Delphi compiles this.

Here I agree with Delphi, because it is impossible to specify the type of TBucket in the specialization (otherwise the cyclic specialization will be obtained), which means that the functions are different.

Issue History

Date Modified Username Field Change
2020-09-05 13:01 BlackShark New Issue
2020-09-05 13:01 BlackShark File Added:
2020-09-07 10:07 Sven Barth Tag Attached: generics
2020-09-07 14:15 delfion Note Added: 0125424
2020-09-07 14:16 delfion Note Edited: 0125424 View Revisions
2020-09-07 14:36 Bart Broersma Note Added: 0125426
2020-09-07 17:09 Serge Anvarov Note Added: 0125428