2
0

tb0259.pp 561 B

123456789101112131415161718192021222324252627282930
  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. type
  10. TLongArray = array of longint;
  11. procedure fvar(var a: TLongArray);
  12. begin
  13. setlength(a,100);
  14. a[2]:=1;
  15. end;
  16. function f: TLongArray;
  17. begin
  18. // Warning for the dyn array Result, since initial contents of the Result is undefined.
  19. fvar(Result);
  20. end;
  21. begin
  22. f;
  23. end.