As is known, starting from version 3.2.0 FPC supports generic free-standing (i.e. standing out of a type declaration) procedures / functions. Since this new feature is documented only here:
https://wiki.freepascal.org/FPC_New_Features_3.2.0#Support_for_Generic_Routines, no mention in the language reference guide, I did some experiments to better understand benefits and limitations.
I found that the following program in FPC 3.2.0 generates an internal error (always, not randomly):
program Project1;
{$mode ObjFPC}
procedure AddGroup;
generic procedure Add<T>(const X : T; const Y : T; out Z : T);
begin
Z:=X+Y;
end;
var
R : integer;
begin
specialize Add<integer>(4,5,R);
end;
begin
AddGroup;
end.
Compiler Output:
C:\Users\simon\AppData\Local\Temp\project1.lpr(16,6) Fatal: Internal error 200511152I don't know if generic nested procedures / functions are supported. If not, I would still expect a syntax error, not an internal error. What do you think?