[fpc-pascal] Primitive Record Wrappers

Sven Barth pascaldragon at googlemail.com
Mon Feb 29 17:16:43 CET 2016


Am 29.02.2016 16:13 schrieb "Mazola Winstrol" <mazofeifer at gmail.com>:
>
> I have noticed that, by using generics, we can't overload arithmetic
operators.
>
> E.g.:
>
> ...
> class operator Negative(A: TNullableType<T>): T;
> ...
>
> class operator TNullableType<T>.Negative(A: TNullableType<T>): T;
> begin
>     Result := -1 * A;
> end;
> ....
>
> wouldn't compile with the error "Operator not applicable to this operand
type".
>
> Is there any workaround to overcome this?

As far as I am concerned that *should* work. If it does not, then it's a
bug. Please file a bug report with a simple example program.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160229/1b43f1b0/attachment.html>


More information about the fpc-pascal mailing list