Hi,

I have an issue with some KDE4 code (built against Qt 4.8.6) where a
dynamic_cast fails on OS X but not on Linux (be it with gcc or clang
3.5). In a nutshell:

class D: public class C, public class B, public class A;

with C inheriting QObject (ultimately), the others being "root
classes". The failing cast goes like this:

C *part = m_tab[0]
A *a = dynamic_cast<A*>(part);

If m_tab[0] were indeed a class C* the failure would be
understandable, but the code's author tells me it's actually a class
D*.

This is only Qt related insofar as C inherits QObject, but I was
hoping to get some pointers which could help me figure out what goes
wrong here. Does Qt have some mechanism by which I can check the
actual type of the pointer stored in m_tab[0] (evidently
typeid(part).name() will tell me it's a class C) or even if it's an
invalid pointer? Running through valgrind didn't teach me anything.
Would the debugger in Qt Creator allow me to follow what happens
during that dynamic_cast?

Thanks,
R
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to