Boost C++ Libraries: Ticket #3991: Boost::Python register_exception_translator doesn't work in c++0x. https://svn.boost.org/trac10/ticket/3991 <p> Error message: </p> <pre class="wiki"> 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&lt;Target&gt;*) [with ExceptionType = std::out_of_range, Translate = void (*)(const std::out_of_range&amp;)]’: 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&lt;std::out_of_range, void (*)(const std::out_of_range&amp;)&gt;, boost::arg&lt;1&gt;&amp;, boost::arg&lt;2&gt;&amp;, void (*&amp;)(const std::out_of_range&amp;))’ is ambiguous /usr/include/boost/bind/bind.hpp:1322:5: note: candidates are: boost::_bi::bind_t&lt;R, F, typename boost::_bi::list_av_3&lt;A1, A2, A3&gt;::type&gt; boost::bind(F, A1, A2, A3) [with R = bool, F = boost::python::detail::translate_exception&lt;std::out_of_range, void (*)(const std::out_of_range&amp;)&gt;, A1 = boost::arg&lt;1&gt;, A2 = boost::arg&lt;2&gt;, A3 = void (*)(const std::out_of_range&amp;), typename boost::_bi::list_av_3&lt;A1, A2, A3&gt;::type = boost::_bi::list3&lt;boost::arg&lt;1&gt;, boost::arg&lt;2&gt;, boost::_bi::value&lt;void (*)(const std::out_of_range&amp;)&gt; &gt;] /usr/include/c++/4.5/functional:1390:5: note: std::_Bind_result&lt;_Result, typename std::_Maybe_wrap_member_pointer&lt;_Functor&gt;::type(_ArgTypes ...)&gt; std::bind(_Functor, _ArgTypes ...) [with _Result = bool, _Functor = boost::python::detail::translate_exception&lt;std::out_of_range, void (*)(const std::out_of_range&amp;)&gt;, _ArgTypes = {boost::arg&lt;1&gt;, boost::arg&lt;2&gt;, void (*)(const std::out_of_range&amp;)}, typename std::_Maybe_wrap_member_pointer&lt;_Functor&gt;::type = boost::python::detail::translate_exception&lt;std::out_of_range, void (*)(const std::out_of_range&amp;)&gt;] </pre><p> When I compile with: <code>g++-4.5 -std=c++0x -I/usr/include/python2.6 -lboost_python -lpython2.6 test.cpp</code> </p> <p> Test file: </p> <pre class="wiki">#include &lt;boost/python.hpp&gt; void translate_out_of_range(std::out_of_range const&amp; e) { PyErr_SetString(PyExc_IndexError, e.what()); } int main() { boost::python::register_exception_translator&lt;std::out_of_range&gt;(&amp;translate_out_of_range); } </pre><p> The problem appears to be the collision between boost::bind and std::bind (new in c++0x). </p> <p> The fix is trivial: in boost/python/exception_translator.hpp line 21, simply use boost::bind(...) instead of bind(...) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3991 Trac 1.4.3 foom@… Mon, 03 May 2010 18:11:10 GMT <link>https://svn.boost.org/trac10/ticket/3991#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3991#comment:1</guid> <description> <p> Ping? Trivial patch; can it be applied? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dave Abrahams</dc:creator> <pubDate>Mon, 03 May 2010 19:25:29 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/3991#comment:2 https://svn.boost.org/trac10/ticket/3991#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> I'd love to but will be completely swamped until after <a class="wiki" href="https://svn.boost.org/trac10/wiki/BoostCon">BoostCon</a> </p> Ticket Matthew Bradbury <matt-bradbury@…> Wed, 25 Aug 2010 18:15:16 GMT <link>https://svn.boost.org/trac10/ticket/3991#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3991#comment:3</guid> <description> <p> Wasn't this fixed in <a class="changeset" href="https://svn.boost.org/trac10/changeset/62198" title="Explicitly qualify bind with boost::. Fixes #4223.">r62198</a>? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dave Abrahams</dc:creator> <pubDate>Wed, 25 Aug 2010 18:50:52 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3991#comment:4 https://svn.boost.org/trac10/ticket/3991#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Looks like it, thanks. </p> Ticket