[fpc-pascal] Empty Set in constants in generics

Sven Barth pascaldragon at googlemail.com
Mon May 4 20:03:24 CEST 2020


Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Mo., 4. Mai 2020, 18:48:

> Should generics accept empty sets as constants? I think they should and
> this is a bug but I wanted to ask first.
>
> ========================
>
> {$mode objfpc}
>
> program test;
>
> type
>   TItem = (A, B, C);
>   TItems = set of TItem;
>   generic GType<const T: TItems> = class
>   end;
>
> const
>   TOtherItems = [];   // no problems here
>
> type
>   // error: Incompatible types: got "Empty Set" expected "TItems"
>   TType = specialize GType<[]>;
>
> begin
> end.
>

Yes, they should indeed.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200504/ac81a6f1/attachment.htm>


More information about the fpc-pascal mailing list