[fpc-devel] Implicit function specialization precedence

Ryan Joseph genericptr at gmail.com
Fri Apr 9 18:58:39 CEST 2021


I just realized one more type introspection related issue. This currently will specialize as DoThis<ShortInt>  because the array constructor element type is "shortint" as is derived from the first element 1. This of course is not correct so I'd like to reject "array of const constructors" but I don't see how to know what when I get this type.

 I thought the tarraydef would have ado_IsArrayOfConst set but it does not, so how do I know the array constructor has multiple element types?

generic procedure DoThis<T>(a: array of T);
begin
end;

begin
  DoThis([
    1,
    'string',
    'c',
    TObject.Create
  ])
end.

Regards,
	Ryan Joseph



More information about the fpc-devel mailing list