blob: d5bac17ac118f5bf67832c8b696c5ff95077c726 (
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
|
{ %fail }
{$mode objfpc}
type
generic tc1<T> = class
public
x : T;
end;
generic tc2<T> = class
type tc2a = specialize tc1<T>;
var x : tc2a;
end;
tc2_Integer = specialize tc2<Integer>;
var
a : tc2_Integer;
begin
a := tc2_Integer.Create;
a.x := tc2.tc2a.Create; // this is not allowed, user must use specialization of tc2
a.x.x := 99;
if (a.x.x <> 99) then
Halt(1);
end.
|