Boost C++ Libraries: Ticket #6755: [result_of] Inconsistent results between function references and function pointers https://svn.boost.org/trac10/ticket/6755 <p> For function references, decltype-based <code>boost::result_of</code> uses <code>decltype</code> to determine the type. But, for function pointers, decltype-based <code>boost::result_of</code> falls back to <code>boost::tr1_result_of</code> and does not use <code>decltype</code>. </p> <p> This inconsistency makes different results for function references and function pointers. On clang trunk and gcc-4.7 in a C++11 mode, for "<code>typedef const int F();</code>", </p> <ul><li>decltype-based <code>boost::result_of&lt;F&amp;()&gt;</code> is <code>int</code>, but </li><li>decltype-based <code>boost::result_of&lt;F*()&gt;</code> is <code>const int</code>. </li></ul><p> To remove the inconsistency, decltype-based <code>boost::result_of</code> should use <code>decltype</code> for function pointers. </p> <p> A patch attached. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6755 Trac 1.4.3 Michel Morin Sun, 01 Apr 2012 03:29:55 GMT attachment set https://svn.boost.org/trac10/ticket/6755 https://svn.boost.org/trac10/ticket/6755 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">result_of.patch</span> </li> </ul> <p> This patch fixes the inconsistency. This patch also fixes the test so that the patched <code>result_of</code> passes the test. <code>BOOST_STATIC_ASSERT((is_same&lt;result_of&lt;func_ptr(void)&gt;::type, int&gt;::value));</code> is removed, since this is uncallable. (<code>BOOST_STATIC_ASSERT((is_same&lt;tr1_result_of&lt;func_ptr(void)&gt;::type, int&gt;::value));</code> is kept untouched.) </p> Ticket Daniel Walker Sun, 01 Apr 2012 20:38:40 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6755#comment:1 https://svn.boost.org/trac10/ticket/6755#comment:1 <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/77702" title="Applied patch from Michel Morin to fix #6755. Updated copyright to ...">[77702]</a>) Applied patch from Michel Morin to fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6755" title="#6755: Patches: [result_of] Inconsistent results between function references and ... (closed: fixed)">#6755</a>. Updated copyright to recognize contributors from the past several years. </p> Ticket Daniel Walker Sun, 01 Apr 2012 20:44:43 GMT <link>https://svn.boost.org/trac10/ticket/6755#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6755#comment:2</guid> <description> <p> This is somewhat related to <a class="new ticket" href="https://svn.boost.org/trac10/ticket/6731" title="#6731: Bugs: decltype-based boost::result_of does not conform to std::result_of (new)">#6731</a>. Really, neither pointers nor member pointers should be dispatched to TR1 result_of. This patch takes us part of the way there. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Sun, 02 Sep 2012 03:42:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6755#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6755#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80359" title="merge [77702] to release, fixes #6755">[80359]</a>) merge <a class="changeset" href="https://svn.boost.org/trac10/changeset/77702" title="Applied patch from Michel Morin to fix #6755. Updated copyright to ...">[77702]</a> to release, fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6755" title="#6755: Patches: [result_of] Inconsistent results between function references and ... (closed: fixed)">#6755</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>