tb0260.pp 525 B

123456789101112131415161718192021222324252627
  1. { %fail% }
  2. { %opt=-Sew -vw -O- }
  3. {
  4. Test for correct emitting of warnings/hints for uninitialized variables of management types
  5. See also tbf/tb0258.pp
  6. }
  7. // This code must issue warnings "Function result variable of a managed type does not seem to be initialized".
  8. {$mode objfpc}
  9. procedure fvar(var a: ansistring);
  10. begin
  11. setlength(a,100);
  12. a[2]:='a';
  13. end;
  14. function f: ansistring;
  15. begin
  16. // Warning for the ansistring Result, since initial contents of the Result is undefined.
  17. fvar(Result);
  18. end;
  19. begin
  20. f;
  21. end.