mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-01 12:22:35 +02:00
* crash with constructor/destructor combi
This commit is contained in:
parent
47ba6c2c4e
commit
cd0cbd4436
47
tests/tbs/tb0453.pp
Normal file
47
tests/tbs/tb0453.pp
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user