fpc/tests/test/tgenfunc23.pp
svenbarth c6e377b4a9 --- Merging r45972 into '.':
U    compiler/defcmp.pas
--- Recording mergeinfo for merge of r45972 into '.':
 U   .
--- Merging r47101 into '.':
U    compiler/pexpr.pas
A    tests/webtbs/tw37844.pp
--- Recording mergeinfo for merge of r47101 into '.':
 G   .
--- Merging r47253 into '.':
G    compiler/defcmp.pas
A    tests/webtbs/tw38012.pp
--- Recording mergeinfo for merge of r47253 into '.':
 G   .
--- Merging r47424 into '.':
U    compiler/pdecsub.pas
A    tests/webtbs/tw38083.pp
--- Recording mergeinfo for merge of r47424 into '.':
 G   .
--- Merging r47425 into '.':
U    compiler/nflw.pas
A    tests/webtbs/tw38058.pp
--- Recording mergeinfo for merge of r47425 into '.':
 G   .
--- Merging r47686 into '.':
U    compiler/ncal.pas
A    tests/test/tgenfunc23.pp
--- Recording mergeinfo for merge of r47686 into '.':
 G   .

git-svn-id: branches/fixes_3_2@47803 -
2020-12-17 21:47:29 +00:00

36 lines
608 B
ObjectPascal

program tgenfunc;
{$mode objfpc}
var
TestTCalled: LongInt;
TestArrayOfTCalled: LongInt;
generic procedure Test<T>(const aArg: T);
begin
Inc(TestTCalled);
end;
generic procedure Test<T>(const aArg: array of T);
var
i: SizeInt;
begin
for i := 0 to High(aArg) do begin
specialize Test<T>(aArg[i]);
end;
Inc(TestArrayOfTCalled);
end;
begin
TestTCalled := 0;
TestArrayOfTCalled := 0;
specialize Test<LongInt>(1);
if TestTCalled <> 1 then
Halt(1);
specialize Test<LongInt>([1, 2, 3]);
if TestArrayOfTCalled <> 1 then
Halt(2);
if TestTCalled <> 4 then
Halt(3);
end.