summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw8171.pp
blob: c8146683fa547cc8a5ce6f823af757e253be7d00 (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
{ %cpu=i386 }

program FieldDoesntResolve;

{$IFDEF FPC}
  {$mode delphi}
{$ENDIF}

type
  TMyRecord = record
    rField: Integer;
  end;

  TMyObject = class
  private
    oField: TMyRecord;
  public
    procedure Test;
  end;

{ TMyObject }

procedure TMyObject.Test;
asm
//  mov [eax + TMyObject.oField.rField], 0 // works in Delphi and FPC
  mov [eax + oField.rField], 5 // works only in Delphi
end;

begin
  with TMyObject.Create do try
    Test;
  finally
    if (ofield.rfield <> 5) then
      halt(1);
    Free;
  end;
end.