[fpc-pascal] Interface Inheritance Bug

African Wild Dog paintedlycaon at gmail.com
Sun Mar 19 05:06:50 CET 2017


Hello,

Test env: debian jessie amd64 - fpc 3.0.2

It seems free pascal have a bug when handling interface inheritance using
generics.

When i try to compile the unit bellow, i get this error:

"interface_bug.pas(41,44) Error: Incompatible types: got
"TImplementor<System.LongInt>" expected "IParentInterface<System.LongInt>""


=== CODE ===

*unit* interface_bug;

{$mode delphi}

*interface*

*type*

  IParentInterface<T> = *interface*
    ['{0F78D56E-85A6-4024-98D7-720D7C7B9573}']
    *procedure* Foo;
  *end*;

  IChildInterface<T> = *interface*(IParentInterface<T>)
    ['{1AB2EB85-6843-462E-8CE4-32ECC065011E}']
    *procedure* Bar;
  *end*;

  TImplementor<T> =  class(TInterfacedObject, IChildInterface<T>)
  *public*
    *procedure* Foo;
    *procedure* Bar;
  *end*;

*var*
  ParentImplementorInstance: IParentInterface<Integer>;

*implementation*

*procedure* TImplementor<T>.Foo;
*begin*

*end*;

*procedure* TImplementor<T>.Bar;
*begin*

*end*;

*initialization*
  ParentImplementorInstance:=TImplementor<Integer>.Create;

*end*.


===========
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170319/e51366d8/attachment.html>


More information about the fpc-pascal mailing list