Exceptions, crashes, or RTTI errors around dynamic_cast may indicate that you have performed an illegal listing. dynamic_cast<derived*>(ptrToBase) valid if and only if the derived class and class base satisfy the following restriction: this class or one of its base classes has a virtual member function.
This virtual member function can be any, including a destructor. If you do not have other member functions, you can try:
struct base { virtual ~base(){} ... } struct derived : public base { ... }
base now has a virtual member function and also outputs. Try this and see if it solves your problem.
EDIT-ADD:
@carleeto - In "he already had a virtual destructor", doe it == base?
If the derivative has a virtual destructor, but the database is not a virtual dtor, then you can still get this error.
In addition, you must make sure that the object was not destroyed - after the destructor starts, dynamic_cask is safer to call. Try adding trace to ctors and dtors.
Aaron source share