[fpc-devel] Generic List in Advanded record does not compile with -MobjFPC, works with -MDelphi (perhaps related to Generics.Collections that I am using)

Sven Barth pascaldragon at googlemail.com
Mon Apr 27 21:19:39 CEST 2015


On 27.04.2015 20:31, Michael Ring wrote:
> Argh, soory, cut & waste error, this is the correct thing:
>
>    TSpecialFunctionRegister = record
>      name: String;
>      device: String;
>      address: longWord;
>      bits: TList<TSpecialFunctionBits>;
>      constructor create(theName: String; theAddress: longWord);
>    end;
>

As I expected. Try this:

=== code begin ===

TSpecialFunctionRegister = record
public type
   TSpecialFunctionBitsList = specialize TList<TSpecialFunctionBits>
   // alternatively you could declare that outside of the record as well 
if you need it more often
public
   name: String;
   device: String;
   address: LongWord;
   bits: TSpecialFunctionBitsList;
   constructor Create(theName: String; theAddress: LongWord);
end;

=== code end ===

Regards,
Sven



More information about the fpc-devel mailing list