[fpc-devel] Assigning class procedures
mkambi at poczta.onet.pl
Wed Mar 15 01:29:09 CET 2006
I'm just migrating a lot of code from delphi to objfpc mode, and I
noticed that in objfpc mode I can't do
MyFunc := @TMyClass.Func;
where TMyClass.Func is a class procedure that matches the type of
MyFunc. I'm attaching the complete source code. With
fpc -S2 test_1.pas
the attached code doesn't compile, fails with message
Error: Incompatible types: got "<class method type of
procedure(LongInt) of object;Register>" expected "<procedure variable
type of procedure(LongInt) of object;Register>"
Tested with various FPC versions (2.0.0, 2.0.2, 2.0.3 and 2.1.1
fpc -Sd test_1.pas
it compiles OK.
I initially intended to submit this as a bug, but I decided to ask here
first. This *is* a bug, right ? I mean, delphi mode behavior seems
sensible here, passing class procedures as procedures of objects should
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 456 bytes
Desc: not available
More information about the fpc-devel