[fpc-devel] Assign static class procedure to procedure variable
Ondrej Pokorny
lazarus at kluug.net
Mon Nov 2 08:06:39 CET 2015
On 17.10.2015 12:19, Jonas Maebe wrote:
> On 17/10/15 10:14, Ondrej Pokorny wrote:
>> Ok, that is possible. No chance to get it working in objfpc mode?
>
> It's a known bug since quite a long time, but nobody got around to
> fixing it yet. There's a report for it on the bug tracker.
Thanks for committing the patch. There is room for a small optimization
- you don't have to check "po_staticmethod" afterwards. The check is
already done in "{ b) }". See attached patch. (I cannot attach files to
resolved issue reports, therefore I send it here.)
Ondrej
-------------- next part --------------
Index: compiler/defcmp.pas
===================================================================
--- compiler/defcmp.pas (revision 32219)
+++ compiler/defcmp.pas (working copy)
@@ -2226,7 +2226,7 @@
{ check for method pointer and local procedure pointer:
a) anything but procvars can be assigned to blocks
b) if one is a procedure of object, the other also has to be one
- ("object static procedure" is equal to procedure as well)
+ ("class static procedure" is equal to procedure as well)
(except for block)
c) if one is a pure address, the other also has to be one
except if def1 is a global proc and def2 is a nested procdef
@@ -2263,9 +2263,6 @@
include(pa_comp,cpo_warn_incompatible_univ);
{ check return value and options, methodpointer is already checked }
po_comp:=[po_interrupt,po_iocheck,po_varargs];
- { check static only if we compare method pointers }
- if def1.is_methodpointer and def2.is_methodpointer then
- include(po_comp,po_staticmethod);
if (m_delphi in current_settings.modeswitches) then
exclude(po_comp,po_varargs);
{ for blocks, the calling convention doesn't matter because we have to
More information about the fpc-devel
mailing list