mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 02:28:46 +02:00
38 lines
677 B
ObjectPascal
38 lines
677 B
ObjectPascal
{ %NORUN }
|
|
|
|
program tanonfunc70;
|
|
|
|
{$mode delphi}
|
|
{$modeswitch anonymousfunctions}
|
|
{$modeswitch functionreferences}
|
|
|
|
{ test calling into overloaded routines and creating anonymous methods in them.
|
|
|
|
Similar to tanonfunc61 but with additonal calls to func ref before and after
|
|
anonfunc use of func ref. With func ref inside an anon method, the func
|
|
references outside the anon method will also error out.
|
|
}
|
|
|
|
type
|
|
tproc = reference to procedure;
|
|
tcharproc = reference to procedure(c: char);
|
|
|
|
procedure baz(p: tproc);
|
|
begin
|
|
p();
|
|
end;
|
|
|
|
procedure bar(p: tcharproc); overload;
|
|
begin
|
|
p('b');
|
|
baz(procedure
|
|
begin
|
|
p('a');
|
|
end);
|
|
p('c');
|
|
end;
|
|
|
|
begin
|
|
end.
|
|
|