[fpc-devel] Assign static class procedure to procedure variable
Maciej Izak
hnb.code at gmail.com
Sat Oct 17 09:51:35 CEST 2015
Just use Delphi mode. :)
17.10.2015 09:01 "Ondrej Pokorny" <lazarus at kluug.net> napisaĆ(a):
> Hello!
>
> In Delphi it is valid to assign a static class procedure to a procedure
> variable:
>
> program project1;
>
> type
> TMyObject = class
> public
> class procedure Proc; static;
> end;
>
> TProc = procedure();
>
> class procedure TMyObject.Proc;
> begin
>
> end;
>
> var
> xProc: TProc;
> begin
> * xProc := @TMyObject.Proc;*
> end.
>
> (In Delphi just without the @ operator, obviously.)
>
> In FPC 3.1.1 (trunk) I get the following error:
>
> project1.lpr(22,12) Error: Incompatible types: got "<class method type of
> procedure of object;Register>" expected "<procedure variable type of
> procedure;Register>"
>
> Why? Can it be achieved somehow (compiler settings)?
>
> Ondrej
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20151017/12daeb61/attachment.html>
More information about the fpc-devel
mailing list