tprec5.pp 503 B

1234567891011121314151617181920212223242526272829303132
  1. {$bitpacking on}
  2. program sam8;
  3. { from the gpc testsuite (sam8.pas) }
  4. {
  5. Using a subrange type in a packed recrod seems to break passing the type
  6. by reference
  7. }
  8. type
  9. t1 = 0..100; {Has to be subrange}
  10. r1 = packed record { Has to be packed }
  11. f1 : t1;
  12. end;
  13. procedure proc1(var a1: t1); { Has to be var }
  14. begin
  15. if a1 = 42 then writeln ('OK') else writeln ('failed')
  16. end;
  17. procedure proc2(var a1: t1); { Also has to be var }
  18. begin
  19. proc1(a1);
  20. end;
  21. var a1 : t1;
  22. begin
  23. a1 := 42;
  24. proc2 (a1)
  25. end.