There's some obscure bug in FPC that I haven't been able to reproduce except deep inside my rather large server, but I'm documenting it here in case some one else runs into it and can further characterise it.
The bug manifests only when running with the debugging option "verify method calls" is on.
I create a generic, Tlist<X> where X is some object. At some stage, this is the result of a method. As long as the execution point is in the metbod, the result is fine. But as soon as you exit the method, doing anything with the result causes an invalid typcast, even though the debugger says that nothing has changed about the TList<X> before and immediately after exiting the method.
I can't figure out how to work around this - I cannot use verify method calls (even though it found one other real bug for me)
Actually, freebee: there's another bug in Verify method Calls: if you call the method
TCollectionNotifyEvent<T> = procedure(ASender: TObject; constref AItem: T; AAction: TCollectionNotification)
of object;
under some obscure set of conditions I haven't figured out to characterise but might include the declare T being abstract, while AItem being a sub-class of it, then verify methods says that T is not valid, even though it is. But it only say it's not valid under some conditions
I can't reproduce either of these in a simple application. (not for lack of trying)