fpc/tests/webtbs/tw21044.pp
paul d752ce2c11 compiler:
- postpone insertion of hidden params into record methods after the full record parse to prevent interface and implementation difference because of the possible record size change after the method parse (issue #0021044)
  - skip hidden arguments during methods search for a property setter because of the above change and also for consistency with getter method search
  - test

git-svn-id: trunk@20161 -
2012-01-24 01:45:31 +00:00

38 lines
765 B
ObjectPascal

{ %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.