On 29/07/2025 23:39, Sven Barth via fpc-devel wrote:

Please report a bug. Though this might end up not compiling nevertheless due to the specialization chain going ad infinitum...

https://gitlab.com/freepascal.org/fpc/source/-/issues/41349

It does not need to go ad infinitum.

In the interface, when it encounters the circle, it only needs to know that this is a class (as it does for normal circular class references.)

However, I can see that it is trickier. Because it does need to do the specialisation at some point, so it's available during compiling the implementation. And because the circle can be any amount of steps (greater than 2), it can't defer it until implementation, because if there are more than one step left, then the issue would likely happen then.

I can (with my non existing knowledge of the internals) **imagine** 2 scenarios.

It goes into recursion immediately, but
- detects when it needs to specialize something that is "in progress"
- it does not go into recursion, but adds it to a "todo list", which is processed after the currents specialize.

Of course, it still needs an abort for endless recursion, if it keeps creating new types (e.g. each loop inherits and extends the passed in type)
_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to