summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/tbs/tb0240.pp
blob: beaf2478616c645e508ecfa842957a9b9f1e2560 (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
{ Old file: tbs0280.pp }
{ problem with object finalization.                    OK 0.99.13 (FK) }
{$mode objfpc}
{$H+}

uses
  Erroru;

type
  TMyClass = class
    s: String;
  end;

procedure dotest;

var
  c: TMyClass;
  s : string;

begin
  s:='world';
  s:='Hallo '+s;
  writeln((plongint(s)-4)^);
  c := TMyClass.Create;
  writeln(ptrint(c.s));
  c.s := Copy('Test', 1, 4);
  writeln((pptrint(c.s)-4)^);
  c.free;
end;

var
   mem : sizeint;
begin
  DoMem(mem);
  dotest;
  if DoMem(mem)<>0 then
    Halt(1);
end.