View Issue Details

IDProjectCategoryView StatusLast Update
0037298FPCCompilerpublic2020-07-04 11:57
Reporterdmz73 Assigned ToSven Barth  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Platformx86_64OSWindows 
Product Version3.3.1 
Summary0037298: generic function fails to recognize type and reports error Operator is not overloaded
DescriptionGeneric function that uses the result of another generic function that returns a concrete type fails to recognize that type and instead tries to use the class type.
Steps To Reproduceprogram Project1;
{$mode delphi}
type

  { TC1 }

  TC1 = class
    class function ToInt32<T>(const a: T): int32; static; inline;
  end;

  { TC2 }

  TC2 = class
    class procedure Mul<T>(var a: int32; const b: T); static; inline;
  end;

{ TC1 }

class function TC1.ToInt32<T>(const a: T): int32;
begin end;

{ TC2 }

class procedure TC2.Mul<T>(var a: int32; const b: T);
begin
  a := a * TC1<T>.ToInt32(b); // Error: Operator is not overloaded: "LongInt" * "Class Of TC1"
end;

begin
end.
Tagsgenerics
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

dmz73

2020-07-04 04:33

reporter   ~0123737

Sorry, my fault, this is not an issue. I made a typo in the code while trying to recreate another issue.

Sven Barth

2020-07-04 11:56

manager   ~0123743

Resolving, because the error was in the reporter's code.

To be fair: it took me a bit to notice the error you made, as well. ;)

Please close.

Issue History

Date Modified Username Field Change
2020-07-04 04:30 dmz73 New Issue
2020-07-04 04:33 dmz73 Note Added: 0123737
2020-07-04 11:56 Sven Barth Assigned To => Sven Barth
2020-07-04 11:56 Sven Barth Status new => resolved
2020-07-04 11:56 Sven Barth Resolution open => fixed
2020-07-04 11:56 Sven Barth FPCTarget => -
2020-07-04 11:56 Sven Barth Note Added: 0123743
2020-07-04 11:56 Sven Barth Resolution fixed => no change required
2020-07-04 11:57 Sven Barth Tag Attached: generics