summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw21177.pp
blob: 9f988a75b05d092b31ec10a98e2d5245b5fe1b5b (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
{$modeswitch ADVANCEDRECORDS}
{$OPTIMIZATION REGVAR}
program record_bug;

type
TColor = object
  R : Byte;
  function toDWord : DWord;
end;

function TColor.toDWord : DWord;
begin
  r:=4;
  toDWord:=5;
end;

procedure Fill(Color: TColor);
begin
  Color.toDWord;
  if color.r<>4 then
    halt(1);
end;

var
  c: TColor;
begin
  c.r:=1;
  Fill(c);
end.