Opened 15 years ago
Closed 15 years ago
#1773 closed Bugs (fixed)
VC8 compiler bug makes boost spill types into global namespace, which breaks IntelTBB
Reported by: | Owned by: | Robert Ramey | |
---|---|---|---|
Milestone: | To Be Determined | Component: | serialization |
Version: | Boost 1.35.0 | Severity: | Regression |
Keywords: | Cc: |
Description
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:
!#cpp #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:
!#cpp 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.
Change History (4)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Just for reference, this has been confirmed by Microsoft:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=336708
comment:4 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
fixed - will check in later
The mapping between my example and boost names got messed up: