fpc/tests/webtbs/tw37228.pp
Jonas Maebe 3cb341eabc * ensure that dispose(managed_ptr) does not result in multiple evaluations of
the managed_ptr expression

git-svn-id: trunk@45673 -
2020-06-21 15:10:38 +00:00

19 lines
289 B
ObjectPascal

{$mode objfpc} {$h+}
var
i: longint;
function CreateString: pString;
begin
if i<>0 then
halt(1);
inc(i);
writeln('Creating a string');
new(result);
end;
begin
dispose(CreateString); // prints “Creating a string” twice
if i<>1 then
halt(2);
end.