summaryrefslogtreecommitdiff
path: root/tests/test/tgeneric62.pp
blob: 4cf0ab2602b08856a2612bf3ed5fe8e827c23d10 (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
{ %NORUN }

{ this tests that nested non-generic structured types can be used inside
  generics - here: object in class }
program tgeneric62;

{$ifdef fpc}
  {$mode delphi}
{$endif}

type
  TTest<T> = class
  type
    TTestSub = object
      function Test(a: T): T;
    end;
  end;

function TTest<T>.TTestSub.Test(a: T): T;
begin
  Result := a;
end;

var
  t: TTest<Integer>.TTestSub;
begin
  t.Test(42);
end.