tw1782.pp 815 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. { %fail }
  2. { Source provided for Free Pascal Bug Report 1782 }
  3. { Submitted by "Aleksey V. Vaneev" on 2002-01-27 }
  4. { e-mail: [email protected] }
  5. {$mode objfpc}
  6. type
  7. PStruct = ^TStruct;
  8. TStruct =
  9. packed record
  10. i: LongInt;
  11. end;
  12. TCls = class
  13. protected
  14. Fv: array [1..10] of TStruct;
  15. function getv (i: LongInt): TStruct;
  16. public
  17. property v [i: LongInt]: TStruct read getv;
  18. end;
  19. function TCls.getv (i: LongInt): TStruct;
  20. begin
  21. Result := Fv [i];
  22. end;
  23. var
  24. sp: PStruct;
  25. o: TCls;
  26. begin
  27. o := TCls.create;
  28. { Should fail with 'variable expected' }
  29. sp := @o.v [10];
  30. end.