[fpc-pascal] Enum range check error

Ryan Joseph genericptr at gmail.com
Wed Oct 21 21:59:04 CEST 2020


Is this a bug in generics with default()?

=====================

type
  TEnum = (Unused = '.');
  generic TSomething<T> = class
    function Get: T;
  end; 
  TEnumeratedSomething = specialize TSomething<TEnum>;

function TSomething.Get: T;
begin
  // Range check error while evaluating constants (0 must be between 46 and 46)
  exit(Default(T));
end;


Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list