On 26.09.2013 16:42, Xiangrong Fang wrote:
What should work is the following (now with generics again):
=== code begin ===
type
TTree<T> = class
private type
TSelfClass = class of TTree;
public
function Clone: TTree;
end;
function TTree.Clone: TTree;
begin
Result := TSelfClass(Self.ClassType).__Create(Data, FParent);
(* ... *)
end;
After change to this code in Clone(), I got this error:
tree.pas(66,60) Error: Incompatible type for arg no. 2: Got
"TIntTree.TTree$LongInt", expected "TTree"
Seems like a bug in 2.6.x. It's compiling in 2.7.1.
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal