On 22/04/2022 23:12, Sven Barth via fpc-pascal wrote:
Am 22.04.2022 um 20:51 schrieb Martin Frb via fpc-pascal:


So why does it generate "Add$1" if it does not use it? (Or rather why does it warn, if this is some internal details?)

Add$1 is the symbol of the generic itself, *not* the specialization. But please report it, cause that definitely shouldn't be the case anyway, as the generic is after all used by the specializations (and I should compile with -vh more often...)

=> Then you get an additional hint: "project1.lpr(81,41) Hint: Local proc "Add$1$crc9AB0BCED" is not used" So then that very line generates a specialized version for the call, and then the compiler does not use it.

The compiler essentially works like this: it generates a suitable set of overloads. This includes the non-generic routines as well as all generic routines for which suitable type parameters can be found. Out of this set the compiler will then pick the function it will finally use with a preference for non-generic functions (even if parameters might be a worse, though not incompatible match).

That said: if the compiler does not pick one of the specializations it should totally discard them, so please report a bug for this as well.

Done
https://gitlab.com/freepascal.org/fpc/source/-/issues/39684
https://gitlab.com/freepascal.org/fpc/source/-/issues/39685
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to