Hello,
i have encountered a strange behavior with the compiler when using generics.
I want to have a generic where define the parent class as a parameter. This way I can fake something like multiple inheritance.
When I compile this code I get this error
generic gTest < Test > = class ( Test ) // <-- Gives me this error: class type expected, but got "<undefined type>"
end;
This code again compiles fine if I make a constraint to the generic parameter.
generic gTest < Test: TPersistent > = class ( Test )
function Test123: String; // Some function. This even works with properties and constructors and so on
end;
Everything works as expected until I try the following:
generic gTest < Test: TPersistent > = class ( Test )
destructor Destroy; override; // <- Gives me: There is no method in an ancestor class to be overridden: "destructor Destroy;"
function Test123: String;
end;
It says TPersistent does not have a virtual destructor which is simply not true.
TPersistent = class(TObject,IFPObserved)
...
Destructor Destroy; override;
Should I file a bug report?
See attachment for the full code.