[fpc-devel] Generic List in Advanded record does not compile with -MobjFPC, works with -MDelphi (perhaps related to Generics.Collections that I am using)

Sven Barth pascaldragon at googlemail.com
Tue Apr 28 08:14:32 CEST 2015


Am 27.04.2015 23:27 schrieb "Michael Ring" <mail at michael-ring.org>:
>
> I now officially feel stupid, this now works with the ; in place, I could
have sworn that I have tried this......
>
> But two lines deeper I end up with a new problem now:
>
>   TSpecialFunctionRegisterComparer =
class(TComparer<TSpecialFunctionRegister>)
>     function Compare(constref Left, Right: TSpecialFunctionRegister):
Integer; override;
>   end;
>
> Error: class type expected, but got "TComparer"
> Fatal: class type expected, but got "TComparer"
>
> Is this a similar problem?
>
> If yes then I guess I will need to stay with -Mdelphi the specialize
syntax is not availabe in delphi mode (identifier not found "specialize")
and the generics library where TComparer comes from explicitly sets delphi
mode.

In mode ObjFPC you must use "specialize" when you want to specialize a
class, this includes the declaration of the class parent.
Also mixing generics from different modes makes no difference, the compiler
supports that.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150428/336fb8e8/attachment.html>


More information about the fpc-devel mailing list