Can't cast a Class Type to an TObject
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
A class type (class of ...) variable can't be assigned to a TObject variable, even if casted. So you can't assign a class type variable to the object property of for example a TStringList.
fpc 1.0.x fails, fpc 1.9.x allows it.
As a workaround you can do something like this:
TObject(pointer(AClass))
I think this is a fpc 1.0.x bug, but maybe you have good reasons to disallow the cast, then it is a fpc 1.9.x bug, to allow it.
Additional information:
Reporter: Vincent Snijders
EMail: vslist at zonnet dot nl
Mantis conversion info:
- Mantis ID: 5030
- OS: Linux
- Version: 1.0.10
- Fixed in version: 1.9.0