[fpc-devel] Sven, please look into "cannot return generic derived class" issue

Anthony Walter sysrpl at gmail.com
Thu May 24 17:22:26 CEST 2012


Sven,

When you have the time could you look at issue #22019 titled "Cannot return
generic derived class"? I think it's kind of a big issue because it
prevents anyone from returning a subclass of a generic type. I just want to
know that's you've read the bug report and see/understand the issue.

In a nutshell you currently cannot write something like:

function TList<T>.GetEnumerator: TEnumerator<T>;
begin
  // TListEnumerator<T> inherits from TEnumerator<T>
  return TListEnumerator<T>.Create(Self);
end;

There are other examples, but I think the above and the details provided in
the bug report should be enough to convey the problem.

Thanks Sven! We all very much appreciate your work!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120524/a9e174c9/attachment.html>


More information about the fpc-devel mailing list