summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw10371.pp
blob: b63de1679792276e90b00206d1a7f28327fa3d63 (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
program bug;

{$MODE OBJFPC} {$H+}
{$INLINE ON}

uses
  SysUtils, Classes;

type
  TBug = class
  protected
    fL: longword;
    function InlinedMethod : longword; inline;
  public
    procedure Method1(var Buf); 
    procedure Method2;
  end;

function TBug.InlinedMethod : longword; inline;
begin
  Method1(Result);
end;

procedure TBug.Method2;
var aValue: longword;
begin
  aValue := InlinedMethod;
  fL:=aValue;
end;

procedure TBug.Method1(var Buf);
type
  plongword=^longword;
begin
  plongword(@buf)^:=$12345678;
end;

var
  b: tbug;
begin
  b:=tbug.create;
  b.method2;
  if (b.fl<>$12345678) then
    halt(1);
  b.free;
end.