blob: 2f0afeee874d4674ef08a4deccb6510e9037df3e (
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
|
program tgeneric25;
{$mode objfpc}{$H+}
type
generic TArr<T> = array[0..2] of T;
generic TDynamicArr<T> = array of T;
generic TRecArr<T> = array[0..1] of record
A: T;
B: String;
end;
var
ArrInt: specialize TArr<Integer>;
ArrStr: specialize TArr<String>;
DynArrInt: specialize TDynamicArr<Integer>;
RecArr: specialize TRecArr<Integer>;
begin
ArrInt[0] := 1;
ArrStr[0] := '1';
SetLength(DynArrInt, 1);
DynArrInt[0] := 2;
RecArr[0].A := 3;
RecArr[0].B := '3';
if ArrInt[0] <> 1 then
halt(1);
if ArrStr[0] <> '1' then
halt(2);
if DynArrInt[0] <> 2 then
halt(3);
if RecArr[0].A <> 3 then
halt(4);
end.
|