Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2000-10-30 13:23:34


It turns out there is a longstanding bug where Microsoft Visual C++
can optimize away the catch blocks for a throw from dynamic_cast:

   http://support.microsoft.com/support/kb/articles/Q247/2/03.ASP

The above states version 6, but I have reproduced this in 5 as well.

The following ugly patch seems to fix the problem:

   template<class T,class U> T do_dynamic_cast(U& r) {
     return dynamic_cast<T>(r);
   }
   template<class T,class U> T do_dynamic_cast(U* p) {
     return dynamic_cast<T>(p);
   }
   #define dynamic_cast do_dynamic_cast

Does anyone else have any insight on dealing with this?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk