Boost and C++ Looser Throw Specifier Error

I am compiling a piece of C++ code and it use the Boost error code, when I came across this error and don't know what came about and what to do?

/usr/local/include/boost/system/error_code.hpp:233:21: error: looser throw specifier for ‘virtual const char* boost::system::error_category::std_category::name() const’
virtual const char * name() const BOOST_NOEXCEPT
^
/usr/include/c++/4.9/system_error:81:21: error: overriding ‘virtual const char* std::error_category::name() const noexcept’
name() const noexcept = 0;
^

and three more error pairs concerning these two source file(error_code.hpp and system_error) followed:

/usr/local/include/boost/system/error_code.hpp:243:37: error: looser throw specifier for ‘virtual std::error_condition boost::system::error_category::std_category::default_error_condition(int) const’
virtual std::error_condition default_error_condition( int ev ) const
^
/usr/include/c++/4.9/system_error:87:25: error: overriding ‘virtual std::error_condition std::error_category::default_error_condition(int) const noexcept’
default_error_condition(int __i) const noexcept;
^
/usr/local/include/boost/system/error_code.hpp:245:21: error: looser throw specifier for ‘virtual bool boost::system::error_category::std_category::equivalent(int, const std::error_condition&) const’
virtual bool equivalent( int code, const std::error_condition & condition ) const
^
/usr/include/c++/4.9/system_error:90:14: error: overriding ‘virtual bool std::error_category::equivalent(int, const std::error_condition&) const noexcept’
equivalent(int __i, const error_condition& __cond) const noexcept;
^
/usr/local/include/boost/system/error_code.hpp:247:21: error: looser throw specifier for ‘virtual bool boost::system::error_category::std_category::equivalent(const std::error_code&, int) const’
virtual bool equivalent( const std::error_code & code, int condition ) const
^
/usr/include/c++/4.9/system_error:93:14: error: overriding ‘virtual bool std::error_category::equivalent(const std::error_code&, int) const noexcept’
equivalent(const error_code& __code, int __i) const noexcept;
^

Can any body tell me how to fix this? Thanks so much!
Can any body tell me how to fix this?

Looks like a potential bug to me. Which version of Boost do you have installed?

If you don't use a compiler which supports the noexcept keyword, the macro BOOST_NOEXCEPT expands to the empty string. Compile to a modern standard - C++11 at least.
(It looks like you are using G++4.9, which requires you to explicitly ask for C++11 support.)
See if that works around the problem.

Last edited on
Topic archived. No new replies allowed.