tw1283.pp 581 B

12345678910111213141516171819202122232425262728293031323334353637
  1. { %version=1.1 }
  2. {$mode objfpc}
  3. type
  4. t = class(tobject)
  5. constructor Init;
  6. end;
  7. constructor t.Init;
  8. begin
  9. fail; { constructor will return NULL in ESI now, which is OK }
  10. end;
  11. type
  12. c = class(tobject)
  13. procedure p;
  14. end;
  15. procedure c.p;
  16. var i:t;
  17. begin
  18. i:=t.Init;
  19. if i<>nil then
  20. begin
  21. writeln('Problem with saving a non assigned self');
  22. halt(1);
  23. end;
  24. { returned is NULL in ESI, and AfterConstructor is attempted to call by
  25. referencing an invalid VMT via ESI}
  26. end;
  27. var i:c;
  28. begin
  29. i:=c.create; i.p;
  30. end.