tb0665.pp 569 B

123456789101112131415161718192021222324252627282930313233
  1. program tb0665;
  2. {$mode objfpc}
  3. {$modeswitch advancedrecords}
  4. type
  5. TTest = record
  6. b: Boolean;
  7. function Test(aArg: Pointer): Boolean; inline;
  8. generic function Test<T>: Boolean; inline;
  9. end;
  10. function TTest.Test(aArg: Pointer): Boolean;
  11. begin
  12. b := True;
  13. Result := True;
  14. end;
  15. generic function TTest.Test<T>: Boolean;
  16. begin
  17. Result := Test(Nil);
  18. end;
  19. var
  20. t: TTest;
  21. begin
  22. t.b := False;
  23. { check for side effects to ensure that the code was correctly generated }
  24. t.specialize Test<LongInt>;
  25. if not t.b then
  26. Halt(1);
  27. Writeln('ok');
  28. end.