tw2751.pp 489 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. { %fail }
  2. { Source provided for Free Pascal Bug Report 2751 }
  3. { Submitted by "Micha" on 2003-10-26 }
  4. { e-mail: }
  5. program Construct;
  6. {$mode delphi}
  7. type
  8. ta = class
  9. public
  10. constructor Create(a: tclass);
  11. end;
  12. tb = class(ta)
  13. public
  14. constructor Create(a: tobject);
  15. end;
  16. constructor ta.create(a: tclass);
  17. begin
  18. end;
  19. constructor tb.create(a: tobject);
  20. begin
  21. end;
  22. var
  23. b: tb;
  24. c: tclass;
  25. begin
  26. c := tb;
  27. // This should fail
  28. b := tb.create(c);
  29. b.free;
  30. end.