Am 29.10.2020 um 19:27 schrieb Ryan Joseph via fpc-pascal:
Is it possible that the TypeInfo intrinsic could work with generic template types or is 
this a bug? I get "Illegal qualifier" in the procedure below.

generic procedure DoThis<T>(a: array of T);
begin
   writeln(TypeInfo(T)^.name);
end;

This would fail with a non-generic as well, because the TypeInfo() intrinsic returns a plain Pointer. You need to cast it to PTypeInfo (and obviously the unit TypInfo needs to be used):

PTypeInfo(TypeInfo(T))^.Name

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to