Skip to content

Constants in generics fail with empty sets

Original Reporter info from Mantis: ryan_joseph @genericptr
  • Reporter name: Ryan Joseph

Description:

Specializing a generic with an empty set fails when it should not.

Steps to reproduce:

{$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.

Mantis conversion info:

  • Mantis ID: 37020
  • Version: 3.3.1
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information