diff --git a/include/boost/system/detail/error_category_impl.hpp b/include/boost/system/detail/error_category_impl.hpp index 7052d18..b3ab74c 100644 --- a/include/boost/system/detail/error_category_impl.hpp +++ b/include/boost/system/detail/error_category_impl.hpp @@ -102,18 +102,17 @@ inline char const * error_category::message( int ev, char * buffer, std::size_t inline boost::system::error_category::operator std::error_category const & () const { + if( id_ == boost::system::detail::generic_category_id ) + { + return std::generic_category(); + } + if( id_ == boost::system::detail::system_category_id ) { static const boost::system::detail::std_category system_instance( this, 0x1F4D7 ); return system_instance; } - if( id_ == boost::system::detail::generic_category_id ) - { - static const boost::system::detail::std_category generic_instance( this, 0x1F4D3 ); - return generic_instance; - } - boost::system::detail::std_category* p = ps_.load( std::memory_order_acquire ); if( p != 0 ) diff --git a/test/std_interop_test.cpp b/test/std_interop_test.cpp index 94845d1..5e5fa9d 100644 --- a/test/std_interop_test.cpp +++ b/test/std_interop_test.cpp @@ -44,7 +44,8 @@ static void test_generic_category() int ev = ENOENT; - BOOST_TEST_EQ( bt.message( ev ), st.message( ev ) ); + // Under MSVC, it's "no such file or directory" instead of "No such file or directory" + BOOST_TEST_EQ( bt.message( ev ).substr( 1 ), st.message( ev ).substr( 1 ) ); { boost::system::error_code bc( ev, bt );