<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 03/02/2026 16:58, Hairy Pixels via
      fpc-devel wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAGsUGtkOy_sHAPyP5y9kMY=n9nK6jGO3aspGK6cqcgJbHhS-jg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Feb 3, 2026 at 10:42:05 PM,
          Martin Frb via fpc-devel <<a
            href="mailto:fpc-devel@lists.freepascal.org"
            moz-do-not-send="true" class="moz-txt-link-freetext">fpc-devel@lists.freepascal.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"
          type="cite">
          <div><a
href="https://gitlab.com/freepascal.org/fpc/source/-/issues/41604"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://gitlab.com/freepascal.org/fpc/source/-/issues/41604</a></div>
        </blockquote>
      </div>
      <br>
      <div dir="ltr">
        <pre class="code highlight" lang="plaintext">program Project1;
{$Mode objfpc}
{$Interfaces CORBA}
type
  IFoo = interface end;
  TBar = class(TObject, IFoo) end;

  generic MyGen<A: IFoo> = class end;

  TSome = specialize MyGen<TBar>;

begin

end.
</pre>
        <div dir="ltr">ok so I can see the whole thing now and this
          should compile. TBar implements IFoo and "A" must conform to
          IFoo so TBar is compatible with "A".</div>
      </div>
      <br>
    </blockquote>
    <br>
    Not really.<br>
    <br>
    Below stops compiling, when you uncomment the specialize.<br>
    <br>
    IFoo has a method Test.<br>
    <br>
    TBar does not have that. Only TBar as IFoo would have it. But it
    isn't cast to IFoo.<br>
    <br>
    <br>
    <br>
    program Project1;<br>
    {$Mode objfpc}<br>
    {$Interfaces CORBA}<br>
    type<br>
      IFoo = interface<br>
        procedure Test;<br>
      end;<br>
    <br>
      TBar = class(TObject, IFoo)<br>
        procedure BarTest; virtual; abstract;<br>
        procedure IFoo.Test = BarTest;<br>
      end;<br>
    <br>
      generic MyGen<A: IFoo> = class<br>
        procedure p1(x: A);<br>
      end;<br>
    <br>
      //TSome = specialize MyGen<TBar>;<br>
    <br>
    procedure MyGen.p1(x: A);<br>
    begin<br>
      x.Test<br>
    end;<br>
    <br>
    begin<br>
    <br>
    end.
  </body>
</html>