Skip to content

ImplicitFunctionSpecialization generates dead code / does not use the specialization and reports a hint.

FPC 3.3.1 559fcdf7

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

However there is no unused code.
Using explicit specialization will not give the hint.

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

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

begin
  //specialize Add<byte>(byte(0), byte(0));  // No Hint
  Add(byte(0), byte(0));
end.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information