tgenconst17.pp 440 B

123456789101112131415161718192021222324252627
  1. { %NORUN }
  2. {$mode objfpc}
  3. {$modeswitch advancedrecords}
  4. {
  5. testing range checking for arrays and for-loops
  6. }
  7. program tgenconst17;
  8. type
  9. generic TStaticList<T; const Length: SizeUInt> = record
  10. Values: array[0..Length - 1] of T;
  11. procedure Display;
  12. end;
  13. procedure TStaticList.Display;
  14. var
  15. I, n: SizeUInt;
  16. begin
  17. for I := 0 to Length - 1 do
  18. WriteLn(Values[I]);
  19. end;
  20. var
  21. list: specialize TStaticList<Integer, 20>;
  22. begin
  23. end.