<p dir="ltr">Just use Delphi mode. :)</p>
<div class="gmail_quote">17.10.2015 09:01 "Ondrej Pokorny" <<a href="mailto:lazarus@kluug.net">lazarus@kluug.net</a>> napisał(a):<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hello!<br>
<br>
In Delphi it is valid to assign a static class procedure to a
procedure variable:<br>
<br>
<tt>program project1;</tt><tt><br>
</tt><tt><br>
</tt><tt>type</tt><tt><br>
</tt><tt> TMyObject = class</tt><tt><br>
</tt><tt> public</tt><tt><br>
</tt><tt> class procedure Proc; static;</tt><tt><br>
</tt><tt> end;</tt><tt><br>
</tt><tt><br>
</tt><tt> TProc = procedure();</tt><tt><br>
</tt><tt><br>
</tt><tt>class procedure TMyObject.Proc;</tt><tt><br>
</tt><tt>begin</tt><tt><br>
</tt><tt><br>
</tt><tt>end;</tt><tt><br>
</tt><tt><br>
</tt><tt><tt>var</tt><tt><br>
</tt><tt> xProc: TProc;</tt><tt><br>
</tt>begin</tt><tt><br>
</tt><b><tt> xProc := @TMyObject.Proc;</tt></b><b><tt><br>
</tt></b><tt>end.</tt><tt><br>
</tt><br>
(In Delphi just without the @ operator, obviously.)<br>
<br>
In FPC 3.1.1 (trunk) I get the following error:<br>
<br>
project1.lpr(22,12) Error: Incompatible types: got "<class method
type of procedure of object;Register>" expected "<procedure
variable type of procedure;Register>"<br>
<br>
Why? Can it be achieved somehow (compiler settings)?<br>
<br>
Ondrej<br>
</div>
<br>_______________________________________________<br>
fpc-devel maillist - <a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" rel="noreferrer" target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a><br>
<br></blockquote></div>