Browse Source

* crash with constructor/destructor combi

peter 22 years ago
parent
commit
cd0cbd4436
1 changed files with 47 additions and 0 deletions
  1. 47 0
      tests/tbs/tb0453.pp

+ 47 - 0
tests/tbs/tb0453.pp

@@ -0,0 +1,47 @@
+{$MODE objfpc}
+uses SysUtils, Classes;
+type
+  TFirstClass = class
+    constructor Create;
+    destructor Destroy; override;
+  end;
+  TSecondClass = class(TFirstClass)
+    constructor Create;
+    destructor Destroy; override;
+  end;
+
+constructor TFirstClass.Create;
+begin
+  raise Exception.Create('');
+end;
+
+destructor TFirstClass.Destroy;
+begin
+  WriteLn('TFirstClass.Destroy');
+  inherited Destroy;
+end;
+
+constructor TSecondClass.Create;
+begin
+  inherited Create;
+end;
+
+destructor TSecondClass.Destroy;
+begin
+  WriteLn('TSecondClass.Destroy');
+end;
+
+var
+  o: TSecondClass;
+begin
+  try
+    try
+      o := TSecondClass.Create;
+    finally
+      o.Free;
+    end;
+  except
+    on e: Exception do
+      WriteLn('Exception: ', e.Message);
+  end;
+end.