fork download
  1. program Project1;
  2. {$mode objfpc}{$H+}
  3.  
  4. type
  5.  
  6. generic TFoo<T> = class
  7. function foo: T; virtual; abstract;
  8. end;
  9.  
  10. TRec = record
  11. field: integer;
  12. end;
  13.  
  14. TInter = specialize TFoo<TRec>;
  15.  
  16. TBar = class(TInter)
  17. function foo: TRec; override;
  18. end;
  19.  
  20. function TBar.foo: TRec;
  21. begin
  22. result.field := 0;
  23. exit(result);
  24. end;
  25.  
  26. begin
  27. end.
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Free Pascal Compiler version 2.6.4+dfsg-6 [2015/05/31] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling prog.pas
prog.pas(7,14) Error: Forward declaration not solved "TFoo$TRec.foo:<record type>;"
prog.pas(27,5) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
stdout
Standard output is empty