summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/test/opt/twpo6.pp
blob: 6b22d02bd14bd4349fd1dc38b5031b8eae6f04b1 (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
40
41
42
43
44
45
46
47
48
49
50
51
{ %wpoparas=devirtcalls,optvmts }
{ %wpopasses=1 }

{$mode objfpc}
{$m+}

{ check that multiple descendents properly mark parent class method as
  non-optimisable
}

type
  tbase = class
    procedure test; virtual;
  end;

  tchild1 = class(tbase)
    procedure test; override;
  end;

  tchild2 = class(tbase)
   published
    procedure test; override;
  end;

procedure tbase.test;
begin
  halt(1);
end;

var
  a: longint;

procedure tchild1.test;
begin
  if a<>1 then
    halt(2);
end;

procedure tchild2.test;
begin
  if a<>2 then
    halt(3);
end;

var
  bb: tbase;
begin
  bb:=tchild1.create;
  if (bb is tchild2) then
    halt(1);
end.