[fpc-pascal] Empty Set in constants in generics

Ryan Joseph genericptr at gmail.com
Mon May 4 08:42:58 CEST 2020


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.

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list