[fpc-devel] Problem (bug?) with generics
ugilio at hotmail.com
Fri Sep 14 09:01:59 CEST 2007
> Never mind, it's in the lines before. Seems like fpc doesn't allow
> dereferencing a variable of a generic type in any way. The expression p^
> will generate the error.
Sorry I made the wrong example. The problem isn't in the dereferencing of
but in accessing record fields. Here is simpler example:
TRec32 = packed record
data1 : longword;
data2 : longword;
TRec64 = packed record
data1 : qword;
data2 : qword;
generic TGenClass<_TRec_> = class
TClass32 = specialize TGenClass<TRec32>;
TClass64 = specialize TGenClass<TRec64>;
var rec : _TRec_;
FPC complains in
because rec isn't fully defined, so it finds no field data1 or data2 in rec.
However, I think it should complain only if I try to specialize TGenClass
a type that doesn't have data1 and data2 fields/members/properties.
So I am wondering if this is the correct behaviour, or if it is a bug, or if
is something that is not implemented now but will be in the future.
More information about the fpc-devel