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 47 48 49 50 51 52 53 54 55
|
{ %OPT=-gh }
// Validate that objects with parent are finalized when statically allocated
type
pobj = ^tobj;
tobj = object
public
foo: ansistring;
constructor init(const s: ansistring);
destructor done;
end;
pobj1 = ^tobj1;
tobj1 = object(tobj)
constructor init;
destructor done;
end;
constructor tobj.init(const s: ansistring);
begin
foo:=s;
end;
destructor tobj.done;
begin
end;
constructor tobj1.init;
var
s: ansistring;
begin
s:='abc';
uniquestring(s);
inherited init(s);
end;
destructor tobj1.done;
begin
inherited done;
end;
var
obj: tobj1;
procedure local;
var
instance: tobj1;
begin
instance.init;
end;
begin
HaltOnNotReleased:=true;
local;
obj.init;
end.
|