Nested function reference hangs compiler
Specially the line p := @NestedProc2; causes the compiler to get stuck in an infinite loop.
Free Pascal Compiler version 3.3.1 [2023/03/03] for aarch64
{$mode objfpc}
{$modeswitch anonymousfunctions}
{$modeswitch functionreferences}
program test;
type
TProc = reference to procedure;
function TestNested: TProc;
procedure NestedProc2;
begin
end;
begin
result := procedure
var
p: TProc;
begin
p := @NestedProc2;
end;
end;
var
p: TProc;
begin
p := TestNested;
p();
end.