fpc/bugs/bug0292.pp
1999-09-29 10:44:04 +00:00

40 lines
696 B
ObjectPascal

{$mode objfpc}
type
pobj = ^tobj;
tobj = object
a: ansistring;
constructor init(s: ansistring);
destructor done;
end;
PAnsiRec = ^TAnsiRec;
TAnsiRec = Packed Record
Maxlen,
len,
ref : Longint;
First : Char;
end;
const firstoff = sizeof(tansirec)-1;
var o: pobj;
t: ansistring;
constructor tobj.init(s: ansistring);
begin
a := s;
end;
destructor tobj.done;
begin
end;
begin
readln(t);
writeln('refcount before init: ',pansirec(pointer(t)-firstoff)^.ref);
new(o,init(t));
writeln('refcount after init: ',pansirec(pointer(t)-firstoff)^.ref);
dispose(o,done);
writeln('refcount after done: ',pansirec(pointer(t)-firstoff)^.ref);
end.