[fpc-devel] Generics, TObject Descendant?
cyraid at gmail.com
Fri Feb 20 23:03:25 CET 2015
Ahh, thanks Sven! I'll see if I can post a bug report soon of it.. I'll
use the work-around for now. :)
On 2015-02-19 12:22 AM, Sven Barth wrote:
> On 18.02.2015 20:51, Den wrote:
>> Hi there,
>> Currently this code:
>> TSomeObject<T> = Class;
>> TSomeOtherObject<T : TObject> = Class(TSomeObject<T> );
>> And finally:
>> TMyObject = Class;
>> TSomeOtherOtherObject<T : TMyObject> = Class(TSomeOtherObject<T> );
>> Comes up with error 'got "T" expected "TObject"' .. But TMyObject is
>> based off of TObject?
> At seems that there are still problems if TMyObject is merely a
> forward declaration... the following works:
> === code begin ===
> TSomeObject<T> = Class
> TSomeOtherObject<T : TObject> = Class(TSomeObject<T> );
> TMyObject = Class
> TSomeOtherOtherObject<T : TMyObject> = Class(TSomeOtherObject<T> );
> === code end ===
> Note 1: this is a forward declaration "XYZ = class;", this is not:
> "XYZ = class(TObject);"
> Note2 : a generic /must not/ be a forward declaration (in this case
> A forward declaration of TMyObject should be valid in this case
> however, so please report a bug with an example program attached.
> fpc-devel maillist - fpc-devel at lists.freepascal.org
More information about the fpc-devel