[fpc-devel] Illegal type conversion: "<enumeration type>" to "TObject"

Vinzent Höfler JeLlyFish.software at gmx.net
Fri Jul 18 00:12:18 CEST 2008


Micha Nelissen wrote:
> Michael Van Canneyt wrote:
>>>>  AObject := TObject(AValue);
>>>>
>>>> Could this be supported in the Delphi mode as well?
>>> Please submit a bug report.
>> Eh ? 
>> As far as I'm concerned this should not compile in Objfpc mode as well ?
> 
> It's a typecast, so then almost anything is allowed, except perhaps if
> the size doesn't match.

The latter probably being the problem here, sizes of enumeration types 
differ in Delphi and FPC mode.

Apart from that I don't see any sense in such type of a typecast.

If I were to store such things in a "generic" list data type I would use 
a pointer list, not an object list, if alone to avoid the risk of 
accidentally trying to "Free" such objects.


Vinzent.



More information about the fpc-devel mailing list