Hello, I'm trying to port a Delphi code to FPC, and it has a structure like:
TType = class(TObject) end; TTest<T1; T2: TType> = class(TObject) end; TFoo = class(TType) end; TBar = class(TTest<string, TFoo>) end; I.e., T1 accepts any type, but T2 accepts _only_ TType and/or their descendants. I tried the following code in FPC: TType = class(TObject) end; generic TTest<T1; T2: TType> = class(TObject) end; TFoo = class(TType) end; TBar = class(specialize TTest<string, TFoo>) end; But: === Compile Project, Target: project1.exe: Exit code 1, Errors: 2 Unit1.pas(30,34) Error: class type expected, but got "AnsiString" Unit1.pas(30,47) Error: class type expected, but got "<erroneous type>" === If I declare "T2" instead of "T2: TType", it compiles, but using this declaration, a programmer can use accidentally a non descendant type of TType. Is there an issue about this in bugtracker? Thank you! -- Silvio Clécio My public projects - github.com/silvioprog
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal