[fpc-devel] Problem with generic parameter

Gennady Agranov gennadyagranov at gmail.com
Sat Dec 31 07:07:07 CET 2016


Hi,

Delphi mode, fpc 3.0.0

I have a Sort method:

type

   TArray<T> = class

     class procedure Sort(var Values: array of T; const Comparer: 
IComparer<T>);

   end;

If I call Sort with some real type it compiles and works:

TArray<T>.Sort(string,comparer);

but if i call it from another generic type - it does not compile:

class procedure Arrays<T>.sort(var arr: array of T; const Comparer: 
IComparer<T>);

begin

TArray<T>.Sort(arr,comparer);

end;

Fatal: Syntax error, "CREATE" expected but "SORT" found

Anything I can do to make it compile?

Should I try objfp mode?

Thanks,

Gennady



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20161231/70bebbde/attachment.html>


More information about the fpc-devel mailing list