summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/tbs/tb0573.pp
blob: 30cf7d24b95d4f985d83317b6a1603f6b7b6c829 (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
{$mode objfpc}

type
  tr1 = record
    s: single;
  end;

  tr2 = record
    case byte of
      1: (s: single);
  end;

function f1(r1:tr1): tr1;
var
  s: single;
begin
  s:=r1.s;
  result.s:=s;
end;

function f2(r2:tr2): tr2;
var
  s: single;
begin
  s:=r2.s;
  result.s:=s;
end;

procedure test;
var
  r1,r1a: tr1;
  r2,r2a: tr2;
begin
  r1.s:=1.0;
  r2.s:=2.0;
  r1a:=f1(r1);
  r2a:=f2(r2);
  if r1a.s<>1.0 then
    halt(1);
  if r2a.s<>2.0 then
    halt(1);
end;

begin
  test;
end.