tb0084.pp 595 B

1234567891011121314151617181920212223242526272829303132333435
  1. { %FAIL }
  2. { Old file: tbf0361.pp }
  3. { }
  4. type
  5. ExecProc = Procedure;
  6. type
  7. MenuItem = record
  8. Caption: String[32];
  9. Exec: ExecProc;
  10. end;
  11. Procedure AddItem(ACaption: String; AExec: ExecProc; var Item: MenuItem);
  12. begin
  13. Item.Caption:=ACaption;
  14. Item.Exec:=AExec;
  15. end;
  16. Procedure ExecFirstItem;
  17. begin
  18. Writeln('Result of "Item 1"');
  19. end;
  20. var M1,M2,M3: MenuItem;
  21. Ep: ExecProc;
  22. begin
  23. AddItem('Item 1',Nil,M1);
  24. Ep:=ExecFirstItem; // should give error in fpc mode
  25. AddItem('Item 2',Ep,M2);
  26. AddItem('Item 3',@ExecFirstItem,M3);
  27. end.