fpc/tests/test/cg/tctr1.pp

29 lines
405 B
ObjectPascal

{$mode objfpc}{$h+}
type
tobj=class(TObject)
ffield:boolean;
constructor Create;
procedure AfterConstruction;override;
end;
{ Exit statement in constructor must not jump over AfterConstruction! }
constructor tobj.Create;
begin
exit;
end;
procedure tobj.AfterConstruction;
begin
ffield:=true;
end;
var
o: tobj;
begin
o:=tobj.create;
if not o.ffield then
Halt(1);
end.