Opened 13 years ago
Closed 12 years ago
#3991 closed Bugs (fixed)
Boost::Python register_exception_translator doesn't work in c++0x.
Reported by: | Owned by: | Dave Abrahams | |
---|---|---|---|
Milestone: | Boost 1.43.0 | Component: | python USE GITHUB |
Version: | Boost 1.42.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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(...)
Change History (4)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Status: | new → assigned |
---|
I'd love to but will be completely swamped until after BoostCon
Note:
See TracTickets
for help on using tickets.
Ping? Trivial patch; can it be applied?