Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-04-11 12:48:21


Serge Skorokhodov wrote:
>> Hi all,
>>
>> I've encountered a situation when destructors to local objects
>> are not called after an exception is raised. I use Borland C++
>> version 5.6.4 (Borland C++Builder 6). The examples are compiled
>> with following command to ensure that destructor cleanup is on:
>>
>> bcc32 -RT -x -xd -I<boost_include_path> boosttest.cpp
>> bcc32 -RT -x -xd -I<boost_include_path> boosttest1.cpp
>>
>> The code is attached. [...]
>>
>> The problem is that the object created with the line
>>
>> "shared_ptr<A> spa(new A("Local shared_ptr<A> destroyed!"));"
>>
>> is destroyed in boosttest.cpp and is not destroyed in
>> boosttest1.cpp. If shared_ptr is replaced with plain pointer,
>> everything works fine (see boosttest2.cpp).
>>
>> I would appreciate explaining what's wrong in my code.

Your code seems correct, and all non-Borland compilers agree.

This looks like a particularly evil bcc32 bug.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net