diff --git a/include/boost/python/return_internal_reference.hpp b/include/boost/python/return_internal_reference.hpp index 2f567e55..356bc9ed 100644 --- a/include/boost/python/return_internal_reference.hpp +++ b/include/boost/python/return_internal_reference.hpp @@ -9,14 +9,32 @@ # include # include # include +# include namespace boost { namespace python { +namespace detail +{ + template + struct return_internal_reference_owner_arg_must_be_greater_than_zero +# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) + {} +# endif + ; +} + template struct return_internal_reference : with_custodian_and_ward_postcall<0, owner_arg, Base> { - typedef reference_existing_object result_converter; + private: + BOOST_STATIC_CONSTANT(bool, legal = owner_arg > 0); + public: + typedef typename mpl::select_type< + legal + , reference_existing_object + , detail::return_internal_reference_owner_arg_must_be_greater_than_zero + >::type result_converter; }; }} // namespace boost::python