<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ryan Joseph via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Do., 28. Nov. 2019, 20:36:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Testing on 3.3.1. Are these both bugs? I wanted to ask first before filing a report.<br>
<br>
{$mode objfpc}<br>
<br>
program test;<br>
uses<br>
  FGL;<br>
<br>
// No Error specializing TFPGList in parameter list...<br>
generic function CopyList<T>(source: specialize TFPGList<T>): specialize TFPGList<T>;<br>
begin<br>
end;<br>
<br>
// ... but getting an error specializing TFPGObjectList in parameter list<br>
// Class type expected, but got "T"<br>
generic function CopyList<T>(source: specialize TFPGObjectList<T>): specialize TFPGObjectList<T>;<br>
begin<br>
end;<br>
<br>
begin<br>
end.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">TFPGObjectList has a constraint to class types, so you need to constrain your T as well using ": class". </div><div dir="auto"><br></div><div dir="auto">Please note however that you'll likely encounter another bug then once you move your function to a unit: <a href="https://bugs.freepascal.org/view.php?id=35943">https://bugs.freepascal.org/view.php?id=35943</a></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
===========================<br>
<br>
{$mode objfpc}<br>
<br>
program test;<br>
uses<br>
  FGL;<br>
<br>
// Type identifier expected<br>
// Internal error 2019112401<br>
generic function CopyList<T>(source: specialize FGL.TFPGObjectList<T>): specialize FGL.TFPGObjectList<T>;<br>
begin<br>
end;<br>
<br>
begin<br>
end.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The "specialize" is part of the generic identifier, so it must be "FGL.specialize TFPGObjectList<T>". </div><div dir="auto"><br></div><div dir="auto">That said however an internal error should not happen (especially the one I just added some days ago ^^'). Please report this one. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>