tparray17.pp 664 B

12345678910111213141516171819202122232425262728293031323334
  1. { from gpc tests, original name: pack6.pas }
  2. { Introduced the type declaration. Previously, both arrays were `of 0..3'.
  3. But EP 6.7.5.4 demands the component types to be the same, not only
  4. compatible. GPC detects this now. Frank, 20030417 }
  5. Program Pack6;
  6. {$ifdef fpc}
  7. {$bitpacking on}
  8. type
  9. Integer = ptrint;
  10. {$endif}
  11. Type
  12. T03 = 0..3;
  13. Var
  14. p: packed array [ 1..4 ] of T03;
  15. u: array [ 1..4 ] of T03;
  16. i: Integer;
  17. begin
  18. for i:= 1 to 4 do
  19. u [ i ]:= i - 1;
  20. pack ( u, 1, p );
  21. for i:= 1 to 4 do
  22. if p [ i ] <> i - 1 then
  23. begin
  24. write ( 'failed: p', i, '=', p [ i ], '; ' );
  25. halt(1);
  26. end;
  27. writeln ( 'OK' );
  28. end.