diff --git a/include/boost/python/detail/translate_exception.hpp b/include/boost/python/detail/translate_exception.hpp index 62f931a5..ced11ebb 100644 --- a/include/boost/python/detail/translate_exception.hpp +++ b/include/boost/python/detail/translate_exception.hpp @@ -22,9 +22,20 @@ namespace boost { namespace python { namespace detail { template struct translate_exception { +// workaround for broken gcc that ships with SuSE 9.0 and SuSE 9.1 +# if defined(__linux__) && defined(__GNUC__) \ + && BOOST_WORKAROUND(__GNUC__, == 3) \ + && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) \ + && (BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 1) \ + || BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 3)) + typedef typename remove_reference< + typename add_const::type + >::type exception_non_ref; +# else typedef typename add_reference< typename add_const::type >::type exception_cref; +# endif inline bool operator()( exception_handler const& handler @@ -35,7 +46,16 @@ struct translate_exception { return handler(f); } +// workaround for broken gcc that ships with SuSE 9.0 and SuSE 9.1 +# if defined(__linux__) && defined(__GNUC__) \ + && BOOST_WORKAROUND(__GNUC__, == 3) \ + && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) \ + && (BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 1) \ + || BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 3)) + catch(exception_non_ref& e) +# else catch(exception_cref e) +# endif { translate(e); return true;