fpc/tests/webtbs/tw16901.pp
Jonas Maebe a07bb94fcb * separate the finally block that dezals with cleaning up temps and the
except block that deals with exceptions raised inside the constructor
    (including afterconstruction), so that afterconstruction is always
    called after all temps have been finalised (necessary because in case
    of tinterfacedobject it decreases the reference count of the instance
    without every freeing the instance, so if that is done before a temp
    that also holds a refernce is finalised, the temp may wrongly free
    the instance (mantis #16592, #16592)

git-svn-id: trunk@15583 -
2010-07-15 19:25:40 +00:00

29 lines
334 B
ObjectPascal

{ %opt=-g-h }
program project1;
{$mode objfpc}{$H+}
uses
SysUtils;
type
TClassA = class(TInterfacedObject,IInterface)
public
constructor Create();
end;
constructor TClassA.Create();
var
x : IInterface;
begin
x := Self;
end;
var
y : IInterface;
begin
HaltOnNotReleased := true;
y := TClassA.Create();
end.