blob: b8979731b5519bfb57f25bccc95052297ad1d4f2 (
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
52
53
54
|
{ %wpoparas=devirtcalls,optvmts }
{ %wpopasses=1 }
{$mode objfpc}
{ 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)
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;
a:=1;
bb.test;
a:=2;
bb.free;
bb:=tchild2.create;
bb.test;
bb.free;
end.
|