ImplicitFunctionSpecialization reports incorrect hint

FPC 3.3.1 559fcdf7

The below code reports
project1.lpr(16,26) Hint: Local proc "Add$1$crc6DA5EC80" is not used

So it generates a specialized function, but does not use it.

It should either

  1. Not generate the specialization, if there is an existing function that will be used.

  2. If it relies on the linker to remove the dead code (if indeed the linker will do that), then it should not give the hint.

program Project1;
{$mode objfpc}
{$ModeSwitch ImplicitFunctionSpecialization }

function Add(aArg1, aArg2: Int64): Int64;
begin
  Result := aArg1 + aArg2;
end;

generic function Add<T>(aArg1, aArg2: T): T;
begin
  Result := aArg1 + aArg2;
end;

begin
  Add(Int64(0), Int64(0));
end.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information