[fpc-devel] potential bug, generics vs helpers

Sven Barth pascaldragon at googlemail.com
Fri Jan 27 17:54:13 CET 2012


Am 27.01.2012 17:46, schrieb Thaddy:
> On 27-1-2012 17:25, Marco van de Voort wrote:
>> In our previous episode, Kornel Kisielewicz said:
>>> {$apptype console}
>>>
>>> Type
>>> TLIST<T>=class
>>> end;
>>>
>>> type
>>> Ta= TLIST<POINTER>;
>>> TB= TLIST<POINTER>;
> This may very well be a (semantics) bug in Delphi.
> Did you put this to Embarcadero?
> IMO a type Ta<..> should never be assignable to a type Tb<..> and
> reverse when using generics. (unless with operator overloading or
> similar defined)
> I think this may be an unintentional "feature" in Delphi.

I believe this is intentional as generics are then specialized as (using 
FPC's notation): TList$1$Pointer. There can not be another 
TList$1$Pointer in the current unit, so they must be assignment 
compatible if the Delphi developers didn't purposedly introduce checks 
for the type symbol they belong to (and at least in FPC it can be 
sometimes a bit hard to find the correct symbol one needs).

Regards,
Sven




More information about the fpc-devel mailing list