[fpc-devel] Re: Illegal type conversion: "<enumeration type>"to "TObject"
Jonas Maebe
jonas.maebe at elis.ugent.be
Fri Jul 18 23:58:13 CEST 2008
On 18 Jul 2008, at 23:29, Craig Peterson wrote:
> I am curious about the -CR functionality though. I haven't used it
> before, but according to the User's Guide it "Generates checks when
> calling methods...". We're not calling any methods of the "objects"
> in this case, and I'd be surprised if TStrings was doing anything
> with them other than copying them around, so why wouldn't this be
> compatible?
It verifies more than just method calls (that description is not very
good: it verifies whether self actually points to a valid object/class
instance in case of method calls, and also in some other cases). It
however also verifies class type casts (it basically replaces every
tclass1(instance) with "instance as tclass1"), and also enables
regular range checking at the same time.
That said, I was apparently wrong in saying that classtype(enum) is
incompatible with -CR: the check is only inserted if the type casted
entity is also a class type.
Jonas
More information about the fpc-devel
mailing list