tvarol29.pp 569 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {$ifdef fpc}
  2. {$mode delphi}
  3. {$endif fpc}
  4. {$ifdef FPC_COMP_IS_INT64}
  5. type
  6. comp = double;
  7. {$endif FPC_COMP_IS_INT64}
  8. procedure test(a: comp); overload;
  9. begin
  10. writeln('comp called instead of single');
  11. halt(1)
  12. end;
  13. procedure test(a: single); overload;
  14. begin
  15. writeln('single called instead of comp');
  16. writeln('YYY')
  17. end;
  18. var
  19. v: variant;
  20. x: comp;
  21. y: single;
  22. begin
  23. try
  24. v := x;
  25. test(v);
  26. except
  27. on E : TObject do
  28. halt(1);
  29. end;
  30. try
  31. v := y;
  32. test(v);
  33. except
  34. on E : TObject do
  35. halt(1);
  36. end;
  37. end.