I\'ve seen many mentions of bugs in Delphi 2009 generics, but never expected something so basic to fail in Update 3, no less. Calling IndexOf on a generic TList or TObjectLi
Have a look at this question. Why is TList.Remove() producing an EAccessViolation error?
In particular, try creating your TList like this
TList<TTest>.Create(TComparer<TTest>.Default);
This is a bug in the default constructor of TObjectList<T>
, and I thought it was fixed in update 3. If you're still seeing it, use a different constructor or just update to D2010 or XE, where it's definitely fixed. (And you'll really want to get off of D2009 if you want to work with generics anyway.)