[exception] Virtual destructor warnings (again)

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

On Thu, Sep 11, 2008 at 3:51 AM, Chris Newbold <Chris.Newbold@mathworks.com> wrote:
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.
All of these warnings have been fixed in Trunk already. The problem with warnings is that the test matrix doesn't report them; if a test passes, the build log is discarded. Thus, for a warning to be fixed, someone has to complain about it here. Another problem with discarding successful logs is compile-fail tests: for those, it is important to inspect the compile errors to verify that they are the correct ones. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode

From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Emil Dotchevski Sent: Thursday, September 11, 2008 12:46 PM
On Thu, Sep 11, 2008 at 3:51 AM, Chris Newbold <Chris.Newbold@mathworks.com> wrote:
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.
All of these warnings have been fixed in Trunk already.
I missed that fact since I didn't see a specific fix for the warning I'm getting, but after looking more closely I see that this code has been heavily refactored in trunk and that my specific issue no longer exists. Sorry for the false alarm. -Chris
participants (2)
-
Chris Newbold
-
Emil Dotchevski