summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw15391.pp
blob: 055068e775d1b92376f9e97aa7c98b8ab4875837 (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
39
{$ifdef fpc}
{$mode delphi}
{$endif}

type
  FuncA = function : Integer of object;
  ObjA = class
    function Func1: Integer;
    procedure Proc1(const Arr: Array of FuncA);
  end;

var A : ObjA;

procedure test(fa: funca);
begin
  if fa<>a.func1 then
    halt(2);
end;

function ObjA.Func1: Integer;
begin
  Result := 1;
end;

procedure ObjA.Proc1(const Arr: Array of FuncA);
begin
  if (low(arr)<>0) or
     (high(arr)<>1) or
     assigned(arr[0]) or
     (arr[1]<>a.func1) then
    halt(1);
end;

begin
  A := ObjA.Create;
  A.Proc1([nil,A.Func1]);
  test(a.func1);
  a.free;
end.