
On Jan 18, 2013, at 5:17 PM, Ioannis Papadopoulos <ipapadop@cse.tamu.edu> wrote:
With the minimal test:
#include <boost/tr1/memory.hpp>
int main() { }
I am getting the following using gcc 4.7.2 in C++11 mode:
I tried this with clang in C++11 mode, and got similar errors. In file included from junk.cpp:1: In file included from trunk/boost/tr1/memory.hpp:56: In file included from trunk/boost/shared_ptr.hpp:17: trunk/boost/smart_ptr/shared_ptr.hpp:783:31: error: exception specification in declaration does not match previous declaration template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & ... ^ trunk/boost/tr1/memory.hpp:27:24: note: previous declaration is here template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b); ^ In file included from junk.cpp:1: In file included from trunk/boost/tr1/memory.hpp:56: In file included from trunk/boost/shared_ptr.hpp:17: trunk/boost/smart_ptr/shared_ptr.hpp:788:42: error: exception specification in declaration does not match previous declaration template<class T, class U> shared_ptr<T> static_pointer_cast( ... ^ trunk/boost/tr1/memory.hpp:28:42: note: previous declaration is here template<class T, class U> shared_ptr<T> static_pointer_cast(... ^ In file included from junk.cpp:1: In file included from trunk/boost/tr1/memory.hpp:56: In file included from trunk/boost/shared_ptr.hpp:17: trunk/boost/smart_ptr/shared_ptr.hpp:798:42: error: exception specification in declaration does not match previous declaration template<class T, class U> shared_ptr<T> const_pointer_cast( ... ^ trunk/boost/tr1/memory.hpp:30:42: note: previous declaration is here template<class T, class U> shared_ptr<T> const_pointer_cast(... ^ In file included from junk.cpp:1: In file included from trunk/boost/tr1/memory.hpp:56: In file included from trunk/boost/shared_ptr.hpp:17: trunk/boost/smart_ptr/shared_ptr.hpp:808:42: error: exception specification in declaration does not match previous declaration template<class T, class U> shared_ptr<T> dynamic_pointer_cast( ... ^ trunk/boost/tr1/memory.hpp:29:42: note: previous declaration is here template<class T, class U> shared_ptr<T> dynamic_pointer_cast(... ^ In file included from junk.cpp:1: In file included from trunk/boost/tr1/memory.hpp:56: In file included from trunk/boost/shared_ptr.hpp:17: trunk/boost/smart_ptr/shared_ptr.hpp:928:32: error: exception specification in declaration does not match previous declaration template<class D, class T> D * get_deleter( shared_ptr<T> const & p ) ... ^ trunk/boost/tr1/memory.hpp:31:32: note: previous declaration is here template<class D, class T> D * get_deleter(shared_ptr<T> const & p); ^ In file included from junk.cpp:1: In file included from trunk/boost/tr1/memory.hpp:57: In file included from trunk/boost/weak_ptr.hpp:16: trunk/boost/smart_ptr/weak_ptr.hpp:246:24: error: exception specification in declaration does not match previous declaration template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) BOOST_NOEXCEPT ^ trunk/boost/tr1/memory.hpp:26:24: note: previous declaration is here template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b); ^ 6 errors generated.
It either needs BOOST_NOEXCEPT in memory.hpp or removed in shared_ptr.hpp for the offending functions.
That seems like a good idea to me. In fact, there are several prototypes in memory.h that need it. here's a proposed patch: Index: boost/tr1/memory.hpp =================================================================== --- boost/tr1/memory.hpp (revision 82534) +++ boost/tr1/memory.hpp (working copy) @@ -23,12 +23,12 @@ class bad_weak_ptr; template<class T> class weak_ptr; template<class T> class shared_ptr; -template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b); -template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b); -template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r); -template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r); -template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r); -template<class D, class T> D * get_deleter(shared_ptr<T> const & p); +template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) BOOST_NOEXCEPT; +template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b) BOOST_NOEXCEPT; +template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r) BOOST_NOEXCEPT; +template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r) BOOST_NOEXCEPT; +template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r) BOOST_NOEXCEPT; +template<class D, class T> D * get_deleter(shared_ptr<T> const & p) BOOST_NOEXCEPT; template<class T> class enable_shared_from_this; namespace detail{ With this patch, your test program compiles cleanly here. Can you test this patch on your system? -- Marshall Marshall Clow Idio Software <mailto:mclow.lists@gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki