Boost logo

Boost :

From: Marcus Lindblom (macke_at_[hidden])
Date: 2008-04-03 05:04:23


Hi all,

This is with VC8 SP1.

We tried to compile our app with boost 1.35.0 and got errors in Intel
TBB that int32_t was already defined.

After some debugging, we have boiled it down to the following repro
case, which shouldn't compile. It compiles on VC8 but not on VC9.

Just run cl on the following:

=========================
namespace bzt {
   typedef long fiddle;
}

namespace foo {

using namespace bzt; // removing using makes it work too

class baz
{
public:
     virtual void meep() // removeingvirtual makes it fail
     { }
};

namespace foobar {

   void geronimo() {
       throw baz();
   }

} // namespace foobar

} // namespace foo

fiddle dummy; // should not compile, but does
=========================

For boost, the actual names used are

namespace bzt = boost
fiddle = int32_t
foo = boost_132
baz = bad_weak_ptr
meep = bad_weak_ptr::what
foobar = detail
geronimo = bad_weak_ref
throw baz() = boost::throw_exception(bad_weak_ptr)

and can be reproduced using boost code with simply:

=========================
#include <boost/cstdint.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/serialization/detail/shared_count_132.hpp>

int32_t dummy; // Should not compile, but does.
=========================

The function throwing is
boost_132::detail::sp_counted_base::add_ref_lock() which does boost::throw:

void add_ref_lock()
{
   if(use_count_ == 0) boost::throw_exception(bad_weak_ptr());
   ++use_count_;
}

Where bad_weak_ptr have a virtual function.

I suppose a fix/workaround would be to not use the boost_132 namespace
which imports boost.

This is a pretty bad bug, so we're thinking of switching to VC9 to avoid
this.

Cheers,
/Marcus

P.S. Great work on getting Boost 1.35 out! We really appreciate all the
effort spent and will try harder to find time to test the RCs at root
these things out earlier. Hope this helps somewhat in improving boost
though.


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