blob: 3a002a5e05fa051b76ce6099c4a3299719d171c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
{ %NORUN }
(*
testing application for
https://forum.lazarus.freepascal.org/index.php/topic,47936.0.html
*)
program tw36496b;
{$Mode objfpc}{$H+}
generic function TestGenRecurse<T>(const AInput : T) : Boolean;
begin
//Result := False;
(*
below, if uncommented will fail to compile
tester.lpr(12,19) Error: Identifier not found "TestGenRecurse$1"
*)
specialize TestGenRecurse<T>(AInput);
specialize TestGenRecurse<String>('test');
specialize TestGenRecurse<LongInt>(42);
end;
generic procedure TestGenRecurseProc<T>(const AInput : T);
begin
(*
below method calls compile fine
*)
specialize TestGenRecurseProc<T>(AInput);
specialize TestGenRecurseProc<String>('test');
specialize TestGenRecurseProc<LongInt>(42);
end;
begin
specialize TestGenRecurse<String>('testing');
specialize TestGenRecurseProc<String>('testing');
end.
|