[fpc-devel] RandomFrom vs Generics

Sven Barth pascaldragon at googlemail.com
Wed Jun 6 09:05:59 CEST 2018


Gabor Boros <mlnglsts at bgss.hu> schrieb am Mi., 6. Juni 2018, 08:09:

> Hi All,
>
> This
>
> var
>    x:Integer;
>    a:array of Integer;
>
> begin
>    x:=RandomFrom(a);
>
> code works with 3.0.4 but cannot compile with trunk and got "Error:
> Generics without specialization cannot be used as a type for a
> variable". Tried x:=specialize RandomFrom<Integer>(a); but got "Error:
> Identifier not found "RandomFrom"". How to call RandomFrom with trunk?
>

Seems like a bug due to there being multiple overloads plus the generic.
Would you please report that to the bug tracker?
Does it work if you add "overload;" to the generic's declaration in the
Math unit?

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180606/9066f476/attachment.html>


More information about the fpc-devel mailing list