tgeneric27.pp 495 B

1234567891011121314151617181920212223
  1. program tgeneric27;
  2. { check that specialization does not add enum members to the static symtable and reuses the generic enum definintion }
  3. {$mode objfpc}{$H+}
  4. type
  5. generic TRecArr<T> = array[0..1] of record
  6. case enum:(one, two, three) of
  7. one: (F: Integer);
  8. two: (Z: Byte);
  9. three: (Y: PChar);
  10. end;
  11. var
  12. A: specialize TRecArr<Integer>;
  13. B: specialize TRecArr<String>;
  14. begin
  15. A[0].enum := one;
  16. B[0].enum := one;
  17. if A[0].enum <> B[0].enum then
  18. halt(1);
  19. end.