
I'm running into another instance of virtual destructor warnings with Boost.Exception -- this one when building on Solaris using the Sun Studio 12 compiler. The problem is with the boost::exception_detail::exception_clone class template. It uses CRTP and is often instantiated with a type which has a virtual destructor which has been declared 'throw()'. This causes the compiler to complain that the exception specification for exception_clone's implicitly-generated destructor is too wide: "../../../3p_mirror/sol64/boost/include/boost-1_36/boost/exception/enable_current_exception.hpp", line 121: Warning, wlessrestrictedthrow: Function boost::exception_detail::exception_clone<boost::exception_detail::error_info_injector<boost::bad_function_call>>::~exception_clone() can throw only the exceptions thrown by the function boost::exception_detail::error_info_injector<boost::bad_function_call>::~error_info_injector() it overrides. "../../../3p_mirror/sol64/boost/include/boost-1_36/boost/exception/enable_current_exception.hpp", line 130: Where, temwhilespec: While specializing "boost::exception_detail::exception_clone<boost::exception_detail::error_info_injector<boost::bad_function_call>>". "../../../3p_mirror/sol64/boost/include/boost-1_36/boost/exception/enable_current_exception.hpp", line 130: Where, teminstfrom: Instantiated from boost::function3<void, int&, const char**&, const char**>::operator()(int&, const char**&, const char**) const. "../../../3p_mirror/sol64/boost/include/boost-1_36/boost/signals/signal_template.hpp", line 119: Where, teminstfrom: Instantiated from boost::signal3<void, int&, const char**&, const char**, boost::last_value<void>, int, std::less<int>, boost::function<void(int&,const char**&,const char**)>>::operator()(int&, const char**&, const char**). The fix seems simple enough, and is compatible with other compilers: add an empty destructor declared 'throw()' to exception_clone. Here's the diff: ==== //3rdparty/tmw/boost/boost/exception/enable_current_exception.hpp#1 - /mathworks/devel/sandbox/cnewbold/3rdp/3p/sources/boost/boost/exception/enable_current_exception.hpp ==== @@ -96,6 +96,10 @@ *be1 = *be2; } + ~exception_clone() throw() + { + } + private: detail::atomic_count mutable count_; -Chris