Boost C++ Libraries: Ticket #4072: [result_of] decltype-based implementation breaking valid code on msvc-10 https://svn.boost.org/trac10/ticket/4072 <p> I recently looked into some proto failures on msvc-10 and traced them back to the use of decltype in the implementation of boost::result_of. The program below demonstrates the problem: </p> <pre class="wiki"> // Uncomment the next line to make the problem go away //#define BOOST_NO_DECLTYPE #include &lt;boost/utility/result_of.hpp&gt; template&lt;class X, class Y&gt; struct pair {}; template&lt;class Base&gt; struct S; struct wrapper { template&lt;class T&gt; struct result; template&lt;class This, typename That&gt; struct result&lt;This(That)&gt; { typedef S&lt;That&gt; type; }; template&lt;typename That&gt; typename result&lt;wrapper(That)&gt;::type operator()(That) const { return 0; } }; template&lt;class T&gt; struct S { S(int = 0) {} typename boost::result_of&lt;wrapper(pair&lt;T, T&gt;)&gt;::type foo() { return 0; } }; int main() { S&lt;int&gt; s; } </pre><p> The use of decltype in result_of causes the compiler to recursively instantiate templates until it blows its stack. To make the problem go away, you must #define BOOST_NO_DECLTYPE. </p> <p> I suspect the real problem is in a buggy implementation of decltype on msvc-10. For the upcoming boost release, I suggest that we stick with the non-decltype implementation of result_of on msvc-10, or risk massively breaking users' code, not to mention proto, spirit and xpressive on that compiler. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4072 Trac 1.4.3 Eric Niebler Mon, 05 Apr 2010 22:37:01 GMT attachment set https://svn.boost.org/trac10/ticket/4072 https://svn.boost.org/trac10/ticket/4072 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">result_of_msvc10.patch</span> </li> </ul> <p> patch for result_of on trunk </p> Ticket Eric Niebler Mon, 05 Apr 2010 23:42:18 GMT <link>https://svn.boost.org/trac10/ticket/4072#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4072#comment:1</guid> <description> <p> See <a class="ext-link" href="https://connect.microsoft.com/VisualStudio/feedback/details/548883"><span class="icon">​</span>here</a> for the bug I filed against msvc-10 regarding its decltype behavior. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 04 Feb 2013 22:24:54 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4072#comment:2 https://svn.boost.org/trac10/ticket/4072#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> Closed as merged on release branch. </p> Ticket