|
Boost : |
From: Greg Colvin (gcolvin_at_[hidden])
Date: 2000-10-30 13:52:00
From: Peter Dimov <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, October 30, 2000 11:42 AM
Subject: Re: [boost] dynamic_cast in MSland
> > 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.
>
> Hmm. The example in the article dynamic_casts an uninitialized pointer,
> which is undefined behavior, right?
Yes, but the following program fails to print "caught" if
compiled with /Og and without /EHa.
#include <stdio.h>
struct A { virtual void v() {} };
struct B:A {};
main() {
A a;
try {
dynamic_cast<B&>(a);
} catch (...) {
puts("caught");
}
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk