[Boost-bugs] [Boost C++ Libraries] #3991: Boost::Python register_exception_translator doesn't work in c++0x.

Subject: [Boost-bugs] [Boost C++ Libraries] #3991: Boost::Python register_exception_translator doesn't work in c++0x.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-09 20:08:14


#3991: Boost::Python register_exception_translator doesn't work in c++0x.
---------------------------+------------------------------------------------
 Reporter: foom@… | Owner: dave
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: Python
  Version: Boost 1.42.0 | Severity: Problem
 Keywords: |
---------------------------+------------------------------------------------
 Error message:
 {{{

 In file included from /usr/include/boost/python.hpp:28:0,
                  from test.cpp:1:
 /usr/include/boost/python/exception_translator.hpp: In function ‘void
 boost::python::register_exception_translator(Translate,
 boost::type<Target>*) [with ExceptionType = std::out_of_range, Translate =
 void (*)(const std::out_of_range&)]’:
 test.cpp:6:92: instantiated from here
 /usr/include/boost/python/exception_translator.hpp:20:5: sorry,
 unimplemented: use of ‘type_pack_expansion’ in template
 /usr/include/boost/python/exception_translator.hpp:20:5: sorry,
 unimplemented: use of ‘type_pack_expansion’ in template
 /usr/include/boost/python/exception_translator.hpp:20:5: error: call of
 overloaded
 â€˜bind(boost::python::detail::translate_exception<std::out_of_range, void
 (*)(const std::out_of_range&)>, boost::arg<1>&, boost::arg<2>&, void
 (*&)(const std::out_of_range&))’ is ambiguous
 /usr/include/boost/bind/bind.hpp:1322:5: note: candidates are:
 boost::_bi::bind_t<R, F, typename boost::_bi::list_av_3<A1, A2, A3>::type>
 boost::bind(F, A1, A2, A3) [with R = bool, F =
 boost::python::detail::translate_exception<std::out_of_range, void
 (*)(const std::out_of_range&)>, A1 = boost::arg<1>, A2 = boost::arg<2>, A3
 = void (*)(const std::out_of_range&), typename boost::_bi::list_av_3<A1,
 A2, A3>::type = boost::_bi::list3<boost::arg<1>, boost::arg<2>,
 boost::_bi::value<void (*)(const std::out_of_range&)> >]
 /usr/include/c++/4.5/functional:1390:5: note:
 std::_Bind_result<_Result, typename
 std::_Maybe_wrap_member_pointer<_Functor>::type(_ArgTypes ...)>
 std::bind(_Functor, _ArgTypes ...) [with _Result = bool, _Functor =
 boost::python::detail::translate_exception<std::out_of_range, void
 (*)(const std::out_of_range&)>, _ArgTypes = {boost::arg<1>, boost::arg<2>,
 void (*)(const std::out_of_range&)}, typename
 std::_Maybe_wrap_member_pointer<_Functor>::type =
 boost::python::detail::translate_exception<std::out_of_range, void
 (*)(const std::out_of_range&)>]
 }}}

 When I compile with:
 {{{g++-4.5 -std=c++0x -I/usr/include/python2.6 -lboost_python -lpython2.6
 test.cpp}}}

 Test file:
 {{{
 #include <boost/python.hpp>

 void translate_out_of_range(std::out_of_range const& e) {
 PyErr_SetString(PyExc_IndexError, e.what()); }

 int main() {
 boost::python::register_exception_translator<std::out_of_range>(&translate_out_of_range);
 }
 }}}


 The problem appears to be the collision between boost::bind and std::bind
 (new in c++0x).

 The fix is trivial: in boost/python/exception_translator.hpp line 21,
 simply use boost::bind(...) instead of bind(...)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3991>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC