tgeneric14.pp 509 B

12345678910111213141516171819202122232425262728
  1. { %fail }
  2. {$mode objfpc}
  3. { we test the context sensitivity of generics here, by checking whether names
  4. are looked up at specialization or at definition time.
  5. For the moment this fails, because the assembler symbols are not global and
  6. therefor not accessible from other .o files }
  7. uses
  8. ugeneric14;
  9. const
  10. Foo = 4;
  11. type
  12. TIntTest = specialize TGTest<Integer>;
  13. var
  14. A: TIntTest;
  15. begin
  16. A := TIntTest.Create;
  17. A.DoSomething;
  18. writeln(A.data);
  19. if A.data = 4 then
  20. halt(1);
  21. A.Free;
  22. end.