Boost C++ Libraries: Ticket #8406: boost::_bi::result_traits should handle function pointers https://svn.boost.org/trac10/ticket/8406 <p> I recently modified G++ to enforce the rule that forming a function type with an abstract class as a return or parameter type causes a substitution failure. So now we instantiate return/parameter types during substitution in order to check whether they are abstract. I've gotten a bug report (<a class="ext-link" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56838"><span class="icon">​</span>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56838</a>) that this breaks boost/bind; a trivial example like </p> <pre class="wiki">#include &lt;boost/bind.hpp&gt; void f(); int main() { boost::bind(&amp;f); } </pre><p> causes an error because while forming overload candidates we end up trying to instantiate result_traits&lt;unspecified, void(*)()&gt;, which fails. </p> <p> It seems to me that instead of (or in addition to) all the overloads of bind in bind_cc.hpp, there should be partial specializations of result_traits to deal with function pointers; then the generic function object overload would handle them. That is, specializations like </p> <pre class="wiki">template&lt;class R&gt; struct result_traits&lt;unspecified, BOOST_BIND_ST R (BOOST_BIND_CC *)()&gt; { typedef R type; } </pre><p> The committee may well decide that the G++ behavior is wrong and we should adjust the standard accordingly, but it still seems that this would be an improvement to boost. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8406 Trac 1.4.3 Peter Dimov Fri, 05 Apr 2013 16:02:41 GMT <link>https://svn.boost.org/trac10/ticket/8406#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8406#comment:1</guid> <description> <p> The generic overload can't perform overload resolution. If you have </p> <pre class="wiki">void f( int ); void f( int, int ); </pre><p> then <code>boost::bind( f, 1 )</code> works and selects the first overload. This is not supported by <code>std::bind</code> but existing code that uses <code>boost::bind</code> relies on it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Wed, 11 Dec 2013 17:28:08 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8406#comment:2 https://svn.boost.org/trac10/ticket/8406#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">invalid</span> </li> </ul> Ticket