<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Martin Frb via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Di., 29. Juli 2025, 20:57:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 29/07/2025 09:36, Michael Van Canneyt wrote:<br>
> Same here, you're missing a type parameter. TFoo needs 2 type parameters.<br>
<br>
Ups, thanks.<br>
<br>
Any obvious  (or non obvious) mistake of mine in the below?<br>
<br>
Because either of the 2 commented specialize cause errors in the <br>
generics... (but only if TFoo.F  SWAPS the order of param).<br>
<br>
It compiles fine<br>
- with both the specialize commented<br>
- or with TBar replacing "F" with the commented "F"<br>
<br>
<br>
<br>
program Project1;<br>
{$Mode objfpc}<br>
type<br>
<br>
   generic TBar<A,B> = class; // forward   // LINE 5<br>
<br>
   generic TFoo<A, B> = class<br>
     F:specialize TBar<A,B>;<br>
     X:B;<br>
   end;      // LINE 10<br>
<br>
   generic TBar<A, B> = class<br>
     F:specialize TFoo<B,A>;<br>
     //F:specialize TFoo<A,B>;<br>
     X:B;<br>
   end;<br>
<br>
   //x1 = specialize TBar<Byte, Boolean>;  // project1.lpr(5,28) Fatal: <br>
Syntax error, "identifier" expected but ";" found<br>
   //x2 = specialize TFoo<Byte, Boolean>; // project1.lpr(10,6) Fatal: <br>
Syntax error, "identifier" expected but ";" found<br>
<br>
begin<br>
<br>
end.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Please report a bug. Though this might end up not compiling nevertheless due to the specialization chain going ad infinitum... </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>