Anonymous nested procedure in class crashes compiler
The following program gives a runtime error. I think the anonymous function calling convention is wrong on the anonymous function since this code works if you declare the anonymous function as a nested function.
{$mode objfpc}
{$modeswitch anonymousfunctions}
{$modeswitch nestedprocvars}
program anonymous_proc_error;
type TProc_Nested = procedure(para: integer) is nested;
type
TMyClass = class
field: integer;
procedure Test;
end;
procedure TMyClass.Test;
var
f: TProc_Nested;
begin
f := procedure(para: integer)
begin
writeln(para + field);
end;
f(1);
end;
var
c: TMyClass;
begin
c := TMyClass.Create;
c.Test;
end.