mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-17 04:36:05 +02:00
25 lines
316 B
ObjectPascal
25 lines
316 B
ObjectPascal
program tanonfunc12;
|
|
|
|
{$mode objfpc}
|
|
{$modeswitch anonymousfunctions}
|
|
{$modeswitch functionreferences}
|
|
|
|
{ test anonymous function in global scope }
|
|
|
|
type
|
|
tproc = reference to procedure;
|
|
|
|
var
|
|
i: longint;
|
|
p: tproc;
|
|
begin
|
|
p := procedure
|
|
begin
|
|
i := 123;
|
|
end;
|
|
p();
|
|
if i <> 123 then
|
|
halt(1);
|
|
end.
|
|
|