[fpc-devel] Generic method works on Linux, not on Windows?

Joost van der Sluis joost at cnoc.nl
Tue May 26 21:41:58 CEST 2020


Hi all,

I have something strange.

I have a generic function defined as follows:

generic function TJSONRttiStreamClass.CreateObjectFromJSONString<T 
(AJSONString: TJSONStringType; ADescriptionTag: string = ''): T;
begin
   Result := nil;
end;

When I call it, like this:

LaunchRequest := FSerializer.specialize 
CreateObjectFromJSONString<TDabLaunchRequest>(ACommandText);

Then I get a compiler-error on Windows, while it works on Linux:

csjsonrttistreamhelper.pas(81,1) Error: Wrong number of parameters 
specified for call to "$fin$00000037"

When I make the function empty (Remove Result := nil) it compiles.

Any idea what to look for?

Regards,

Joost.


More information about the fpc-devel mailing list