Am 05.09.2014 16:03 schrieb "Xiangrong Fang" <xrf...@gmail.com>: > > Hi all, > > I am having trouble with the following code: > > generic TVector<T> = class > type > DataType = array of T; > private > //... > protected > //... > public > //... > end; > > generic TSortableVector<T> = class(specialize TVector<T>) > protected > function OnSort(v1, v2: T): Integer; virtual; abstract; > //... > public > procedure Sort(Reversed: Boolean = False; OldOrder: PIntegerDynArray = nil); > //... > end; > > TIntegerVector = class(specialize TSortableVector<Integer>) > protected > function OnSort(v1, v2: Integer): Integer; override; > end; > > The error I got is: > > Error: Forward declaration not solved "TIntegerVector.TSortableVector$LongInt.OnSort(LongInt,LongInt):LongInt;" > > The original code of vector is here: > > https://github.com/xrfang/fpcollection/blob/master/src/units/vector.pas > > I am having trouble with the original code while specializing TVector with a Record type that does not have comparison operators. So I decide to make OnSort() abstract, and add it whenever needed. > > I am running FPC 2.6.4 on Linux x64.
Please test first with 2.7.1. If it does work there, then you'll need to wait till it is released, otherwise you can open a bug report (with a simplified example please, just the virtual method should be enough). Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal