[fpc-pascal] Generic: record type restriction

silvioprog silvioprog at gmail.com
Fri Dec 12 18:43:25 CET 2014


Hello,

I need to restrict a generic type to accept specialization only of enum
types. In Delphi, I can do that using "T: record", but, when I try to use
it in FPC (even using mode delphi), I got:

project1.lpr(16,42) Error: Record type expected

Small project to reproduce the error in attachment.

Is this a normal behavior of the compiler, or is my code a erroneous
approach?

Thank you!

-- 
Silvio Cl├ęcio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20141212/b339ab13/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GenEnum.zip
Type: application/zip
Size: 1930 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20141212/b339ab13/attachment.zip>


More information about the fpc-pascal mailing list