[C++-sig] Re: Problems with dynamic casts
David Abrahams
dave at boost-consulting.com
Mon Mar 14 19:21:40 CET 2005
Aaron Bentley <abentley at panoramicfeedback.com> writes:
> Hi,
> I'm having a problem with dynamic casting on an object constructed using
> Python. It seems as though the type of an owned object is being lost.
>
> I have a test as follows:
>
> assert (dynamic_cast<element::Comments *>(loc.getElement(elists[0]))
> !=NULL);
>
> When I invoke it from the constructor of the owning object (the object
> that owns elists), the test passes. But when I construct the owning
> object and then invoke the test through Python, it fails.
>
> I'm using gcc 3.0.4 from Debian stable.
>
> This looks ugly to me. So far the only explanation I've been able to
> come up with is memory corruption.
I suggest you reduce your problem to the smallest possible example
that illustrates it. The answer will probably become obvious to you,
but if it doesn't, please post your example here.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list