[fpc-pascal] Assigning a result of a method reference
Joao Morais
post at joaomorais.com.br
Sat Jun 23 23:28:05 CEST 2007
Hello,
Taking the following code:
{$mode objfpc}{$h+}
class function tfoo.classmetadata: string;
var
vmetadatamethod: function: string of object;
begin
vmetadatamethod := @internalmetadatastr;
// more code
Result := vmetadatamethod;
end;
the last assignment doesn't compile, the compiler complains that:
Error: Incompatible types: got "<procedure variable type of
function:AnsiString of object;Register>" expected "AnsiString"
Current 2.2 fixes branch.
If I remove the at operator, this code compiles under $mode delphi.
What can I do to make it work under objfpc?
Thanks.
--
Joao Morais
More information about the fpc-pascal
mailing list