summaryrefslogtreecommitdiff
path: root/tests/webtbs/tw21044.pp
blob: bc5aaec9f96621bf6b93c3a1b4a83986524753d1 (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
{ %norun}
program tw21044;

{$mode Delphi}

uses
  SysUtils, Classes;

type
  { TTestRecord }

  TTestRecord = record
  public
    function Test(const Lhs, Rhs: TTestRecord): TTestRecord;
    // operator overloads
    class operator Add(const Lhs, Rhs: TTestRecord): TTestRecord;
    // this part changes the size of record and so the way of parameter handling
    // on some 64bit systems
  case Boolean of
    False: (Value: Single);
    True: (AsInteger: Integer);
  end;

{ TTestRecord }

function TTestRecord.Test(const Lhs, Rhs: TTestRecord): TTestRecord;
begin
  Result.AsInteger := Lhs.AsInteger + Rhs.AsInteger;
end;

class operator TTestRecord.Add(const Lhs, Rhs: TTestRecord): TTestRecord;
begin
  Result.Value := Lhs.Value + Rhs.Value;
end;

begin
end.