Boost logo

Boost Users :

From: Brian Neal (bneal_at_[hidden])
Date: 2002-09-18 19:54:59


I'm new here; I searched the Yahoo archive and didn't see anything about
this so I apologize if this has been discussed before.

Today I learned (the hard and painful way) that there is a bug in Borland
C++ Builder 5.5 such that when compiling with debug support, the compiler
thinks it needs to generate destructors in the wrong translation units. We
noticed this because we were using the "handle-body" idiom with auto_ptr's
(taking all the precautions from Herb Sutter's Exceptional C++ books) and
our destructors were not getting called. We switched over to
boost::shared_ptr's and the handy-dandy compile time check in the destructor
for incomplete types was firing...but in the code that uses and declares
objects of the classes that have the handle-body idiom...a pretty serious
bug in my view.

We then tried to compile the example code from boost for scoped_ptr and it
would not compile for the same reason.

A quick search of the newsgroups reveals that others have found this bug,
and C++ Builder is the only major compiler that has this flaw. I've heard
that it has been fixed in version 6. Can others verify this?

So I am posting this for 2 reasons: 1) to let others know about it (in case
you don't know already), and 2) I noticed that in the Boost compiler status
web-page it says that smart_ptr passed all its tests with C++ Builder 5.5.1.
I didn't look at the tests, but was this handle-body type usage tested to
make sure the destructor was called? Or perhaps it was but without debug
support turned on?

Thanks,
Brian Neal


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