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

Michael Ring mail at michael-ring.org
Mon Apr 27 20:31:28 CEST 2015


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;



Am 27.04.15 um 20:28 schrieb Sven Barth:
> On 27.04.2015 20:19, Michael Ring wrote:
>> I am not sure if this is a problem of the Generics.Collections unit I am
>> using (https://github.com/dathox/generics.collections) as this unit is
>> always compiled with -Mdelphi or if this is an issue with fpc's parser.
>>
>> The following snippet compiles fine in delphi mode, but does not compile
>> in ObjectFPC Mode:
>>
>> type
>>    TSpecialFunctionBits = record
>>      name: String;
>>      Position: longWord;
>>      Mask: longWord;
>>      notMask: longWord;
>>      Length: longWord;
>>      constructor create(theName: String; thePosition, theMask,
>> theLength: longWord);
>>    end;
>>
>> Error is:
>>
>> Fatal: Syntax error, ";" expected but "<" found
>>
>> I saw this error with trunk fpc.
>
> Are you sure that's the correct location? I don't see a "<" anywhere 
> there. Can it be that you are missing a "specialize" where you're 
> specializing the generic? Also note that ObjFPC does not support 
> inline specializations (yet), specializations must be done in "type" 
> sections.
>
> Regards,
> Sven
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list