mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 17:47:56 +02:00

The main adjustments were as follows: - fixing coding style and identation - fixing some typos - using a better name for the property in tcallcandidates which holds the symbols created for anonymous parameter values
25 lines
479 B
ObjectPascal
25 lines
479 B
ObjectPascal
{%NORUN}
|
|
{$mode objfpc}
|
|
{$modeswitch implicitfunctionspecialization}
|
|
{
|
|
Test specializing proc vars by infering parameters from callback function
|
|
}
|
|
|
|
program timpfuncspez14;
|
|
|
|
type
|
|
generic TProc<S> = procedure(name: S; value: integer);
|
|
|
|
generic procedure Run<T, U>(proc: specialize TProc<T>; context: U);
|
|
begin
|
|
proc('TProc', context);
|
|
end;
|
|
|
|
procedure DoCallback(name: string; value: integer);
|
|
begin
|
|
writeln(name, ' called ', value);
|
|
end;
|
|
|
|
begin
|
|
Run(@DoCallback, 100);
|
|
end. |