[lazarus] Compiler problem ?

Marc Weustink weus at quicknet.nl
Mon Jul 31 20:49:15 EDT 2000


Hi

WHile debugging why my selectiongrabbers arent shown, I ran into the 
folowing problem. When running the following example, it dumps when 
LocalFunc is called through the THE_FUNC constant. It seems that the parent 
function param insn't reffered correctly.

Marc


--------------------------------------------------------


program FuncConst;

{$mode objfpc}


type
   PInteger = ^Integer;

function TestFunc(P: PInteger): Boolean;
type
   TMyFunc = function: Boolean;

   function LocalFunc: Boolean;
   begin
     Result := (P^ <> 0);
   end;

   const
     THE_FUNC: TMyFunc = @LocalFunc;

   begin
     // Works OK
     Result := LocalFunc;

     // Dumps
     Result := THE_FUNC();
   end;

var
   X: Integer;

begin
   TestFunc(@X);
end.






More information about the Lazarus mailing list