[fpc-devel] -CR (method checking) and casting of classes
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Aug 2 10:47:42 CEST 2009
On 02 Aug 2009, at 04:17, Martin wrote:
> I am wondering if the code below is valid or not.
It is not.
> It executes, but compiled with -CR gives a runtime error in
> fpc_check_object
>
> xfoo is a variable to store a class of TFooClass, or any inherited
> class. It is initialized with the inherited class TBar.
No, it is initialised with tfoo in your test program:
> begin
> xfoo := tfoo;
> However casting tothe class of TBar (using TBarClass) causes an
> error?
If you initialise xfoo with tbar, the casting works fine.
Jonas
More information about the fpc-devel
mailing list