tcpstr22.pp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. program tcpstr22;
  2. {$MODE DELPHI}
  3. type
  4. cp1253string = type AnsiString(1253);
  5. // --- all string types ---
  6. procedure test_overload1(const s: AnsiString); overload;
  7. begin
  8. end;
  9. procedure test_overload1(const s: UTF8String); overload;
  10. begin
  11. halt(1);
  12. end;
  13. procedure test_overload1(const s: cp1253string); overload;
  14. begin
  15. halt(1);
  16. end;
  17. procedure test_overload1(const s: unicodestring); overload;
  18. begin
  19. halt(1);
  20. end;
  21. procedure test_overload1(const s: widestring); overload;
  22. begin
  23. halt(1);
  24. end;
  25. procedure test_overload1(const s: ShortString); overload;
  26. begin
  27. halt(1);
  28. end;
  29. // --- no AnsiString ---
  30. procedure test_overload2(const s: UTF8String); overload;
  31. begin
  32. end;
  33. procedure test_overload2(const s: cp1253string); overload;
  34. begin
  35. halt(2);
  36. end;
  37. procedure test_overload2(const s: unicodestring); overload;
  38. begin
  39. halt(2);
  40. end;
  41. procedure test_overload2(const s: widestring); overload;
  42. begin
  43. halt(2);
  44. end;
  45. procedure test_overload2(const s: ShortString); overload;
  46. begin
  47. halt(2);
  48. end;
  49. // --- no AnsiString, UTF8String ---
  50. procedure test_overload3(const s: cp1253string); overload;
  51. begin
  52. end;
  53. procedure test_overload3(const s: unicodestring); overload;
  54. begin
  55. halt(3);
  56. end;
  57. procedure test_overload3(const s: widestring); overload;
  58. begin
  59. halt(3);
  60. end;
  61. procedure test_overload3(const s: ShortString); overload;
  62. begin
  63. halt(3);
  64. end;
  65. // --- no AnsiString, UTF8String, AnsiString(codepage) ---
  66. procedure test_overload4(const s: unicodestring); overload;
  67. begin
  68. end;
  69. {ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
  70. procedure test_overload4(const s: widestring); overload;
  71. begin
  72. halt(4);
  73. end;
  74. {$endif}
  75. procedure test_overload4(const s: ShortString); overload;
  76. begin
  77. halt(4);
  78. end;
  79. // --- no AnsiString, UTF8String, AnsiString(codepage), UnicodeString ---
  80. procedure test_overload5(const s: widestring); overload;
  81. begin
  82. end;
  83. procedure test_overload5(const s: ShortString); overload;
  84. begin
  85. halt(5);
  86. end;
  87. var
  88. A: AnsiString;
  89. begin
  90. test_overload1(A);
  91. test_overload2(A);
  92. test_overload3(A);
  93. test_overload4(A);
  94. test_overload5(A);
  95. end.