Hi, The VC++ compiler (6.0 with SP 5) has problems with member function templates. We have encountered a couple of situations where a shared_ptr was created and an attempt was later made to assign a raw pointer to it. However, 1) The compiler fails to recognise that you can't assign a raw pointer to an existing shared pointer object 2) The compiler fails to generate any code whatsoever for the assignment 3) The compiler remains silent about its problems We realise that one way to help the compiler to recognise invalid statements is to undefine BOOST_MSVC6_MEMBER_TEMPLATES. We are now considering to enforce this undefine across our project. Does anyone know which boost features would become inaccessible? Regards, Jacob
From: "jacob_bondski"
The VC++ compiler (6.0 with SP 5) has problems with member function templates. We have encountered a couple of situations where a shared_ptr was created and an attempt was later made to assign a raw pointer to it. However,
1) The compiler fails to recognise that you can't assign a raw pointer to an existing shared pointer object 2) The compiler fails to generate any code whatsoever for the assignment 3) The compiler remains silent about its problems
The current code base contains a workaround for this problem: #if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) template<typename Y> shared_ptr & operator=(shared_ptr<Y> const & r) // never throws { px = r.px; pn = r.pn; // shared_count::op= doesn't throw return *this; } #endif You can apply it to your version of shared_ptr.hpp, or you can use the CVS version of Boost. The 1.29.0 release is close, so the CVS is (hopefully) pretty stable.
participants (2)
-
jacob_bondski
-
Peter Dimov