Boost C++ Libraries: Ticket #4223: boost::python exception translator causes ambiguous call errors with Visual Studio 2010 https://svn.boost.org/trac10/ticket/4223 <p> There is an occasion where the use of the register_exception_translator template function causes: error C2668: 'boost::bind' : ambiguous call to overloaded function </p> <p> the particular file and line are located here: <a class="ext-link" href="https://svn.boost.org/trac/boost/browser/trunk/boost/python/exception_translator.hpp"><span class="icon">​</span>https://svn.boost.org/trac/boost/browser/trunk/boost/python/exception_translator.hpp</a> </p> <p> Line 21, where the call to bind is not properly scoped to a namespace and causes the compiler to resolve incorrectly. The error looks like this: </p> <pre class="wiki">D:\boost_1_42\boost/python/exception_translator.hpp(21): error C2668: 'boost::bind' : ambiguous call to overloaded function 1&gt; D:\boost_1_42\boost/bind/bind.hpp(1322): could be 'boost::_bi::bind_t&lt;R,F,L&gt; boost::bind&lt;bool,boost::python::detail::translate_exception&lt;ExceptionType,Translate&gt;,boost::arg&lt;I&gt;,boost::arg&lt;2&gt;,Translate&gt;(F,A1,A2,A3)' 1&gt; with 1&gt; [ 1&gt; R=bool, 1&gt; F=boost::python::detail::translate_exception&lt;WSException,init_module_wshook::WSExceptionTranslator&gt;, 1&gt; L=boost::_bi::list3&lt;boost::arg&lt;1&gt;,boost::arg&lt;2&gt;,boost::_bi::value&lt;init_module_wshook::WSExceptionTranslator&gt;&gt;, 1&gt; ExceptionType=WSException, 1&gt; Translate=init_module_wshook::WSExceptionTranslator, 1&gt; I=1, 1&gt; A1=boost::arg&lt;1&gt;, 1&gt; A2=boost::arg&lt;2&gt;, 1&gt; A3=init_module_wshook::WSExceptionTranslator 1&gt; ] 1&gt; C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xxbind1(323): or 'std::tr1::_Bind&lt;_Result_type,_Ret,_BindN&gt; std::tr1::bind&lt;bool,boost::python::detail::translate_exception&lt;ExceptionType,Translate&gt;,boost::arg&lt;I&gt;,boost::arg&lt;2&gt;,Translate&gt;(_Fty,_Arg0,_Arg1,_Arg2)' [found using argument-dependent lookup] 1&gt; with 1&gt; [ 1&gt; _Result_type=bool, 1&gt; _Ret=bool, 1&gt; _BindN=std::tr1::_Bind3&lt;std::tr1::_Callable_obj&lt;boost::python::detail::translate_exception&lt;WSException,init_module_wshook::WSExceptionTranslator&gt;,false&gt;,boost::arg&lt;1&gt;,boost::arg&lt;2&gt;,init_module_wshook::WSExceptionTranslator&gt;, 1&gt; ExceptionType=WSException, 1&gt; Translate=init_module_wshook::WSExceptionTranslator, 1&gt; I=1, 1&gt; _Fty=boost::python::detail::translate_exception&lt;WSException,init_module_wshook::WSExceptionTranslator&gt;, 1&gt; _Arg0=boost::arg&lt;1&gt;, 1&gt; _Arg1=boost::arg&lt;2&gt;, 1&gt; _Arg2=init_module_wshook::WSExceptionTranslator 1&gt; ] 1&gt; while trying to match the argument list '(boost::python::detail::translate_exception&lt;ExceptionType,Translate&gt;, boost::arg&lt;I&gt;, boost::arg&lt;I&gt;, init_module_wshook::WSExceptionTranslator)' 1&gt; with 1&gt; [ 1&gt; ExceptionType=WSException, 1&gt; Translate=init_module_wshook::WSExceptionTranslator 1&gt; ] 1&gt; and 1&gt; [ 1&gt; I=1 1&gt; ] 1&gt; and 1&gt; [ 1&gt; I=2 1&gt; ] 1&gt; wspluginmanager_python.cpp(179) : see reference to function template instantiation 'void boost::python::register_exception_translator&lt;WSException,init_module_wshook::WSExceptionTranslator&gt;(Translate,boost::type&lt;T&gt; *)' being compiled 1&gt; with 1&gt; [ 1&gt; Translate=init_module_wshook::WSExceptionTranslator, 1&gt; T=WSException 1&gt; ] 1&gt; </pre><p> The line of code that would cause such an error is: </p> <pre class="wiki">py::register_exception_translator&lt;WSException&gt;(WSExceptionTranslator()); </pre><p> namespace py = boost::python </p> <p> The fix for this would be to properly use boost::bind at line 21 and cause it to resolve properly on Visual Studio 2010 RTM. </p> <p> Thank you. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4223 Trac 1.4.3 anonymous Mon, 17 May 2010 04:11:22 GMT version, component changed; owner set https://svn.boost.org/trac10/ticket/4223#comment:1 https://svn.boost.org/trac10/ticket/4223#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Dave Abrahams</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.44.0</span> → <span class="trac-field-new">Boost 1.42.0</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">Python</span> </li> </ul> Ticket Steven Watanabe Tue, 25 May 2010 14:22:58 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4223#comment:2 https://svn.boost.org/trac10/ticket/4223#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/62198" title="Explicitly qualify bind with boost::. Fixes #4223.">[62198]</a>) Explicitly qualify bind with boost::. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4223" title="#4223: Bugs: boost::python exception translator causes ambiguous call errors with ... (closed: fixed)">#4223</a>. </p> Ticket