Boost C++ Libraries: Ticket #781: Lambda: (_1 + "y")(string("x")) Doesn't Compile https://svn.boost.org/trac10/ticket/781 <pre class="wiki">This program: #include &lt;iostream&gt; #include &lt;ostream&gt; #include &lt;string&gt; #include &lt;boost/lambda/lambda.hpp&gt; int main() { const std::string s("Hello"); std::cout &lt;&lt; (boost::lambda::_1 + ", world!")(s) &lt;&lt; std::endl; } fails to compile with Boost 1.33.1 (on GCC 3.4.2 and GCC 4.1.1, at least) due to at least two bugs. One bug is in boost/lambda/detail/operators.hpp, lines 269-271. This function, declared to return a lambda_functor, returns a lambda_functor constructed from a tuple. But there is no such constructor. Instead, 'lambda_functor&lt;' should be deleted from line 269 (and the closing '&gt;' from line 271) so that it returns a lambda_functor_base constructed from a tuple. That constructor (which is explicit) does exist, and so does a lambda_functor constructor (which is implicit) from a lambda_functor_base. This is exactly what the macro BOOST_LAMBDA_PTR_ARITHMETIC_E2 immediately below does, and there is no reason for BOOST_LAMBDA_PTR_ARITHMETIC_E1 to be different. Unfortunately, fixing that leaves another, more complicated bug: for some reason, the return type appears to be deduced as const char * instead of std::string. See for yourself. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/781 Trac 1.4.3 Steven Watanabe Mon, 18 Dec 2006 20:18:16 GMT <link>https://svn.boost.org/trac10/ticket/781#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/781#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=1671606 Originator: NO I have submitted a patch for this and a few other things to the mailing list. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>nobody</dc:creator> <pubDate>Wed, 17 Jan 2007 04:13:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/781#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/781#comment:2</guid> <description> <pre class="wiki">Logged In: NO Steven Watanabe's updated patch allows this test case to compile and run successfully. Thanks! Please commit it for 1.34.0. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Wed, 13 Feb 2008 15:57:58 GMT</pubDate> <title>owner, status, component, description changed; severity set https://svn.boost.org/trac10/ticket/781#comment:3 https://svn.boost.org/trac10/ticket/781#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">urzuga</span> to <span class="trac-author">No-Maintainer</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">lambda</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/781?action=diff&amp;version=3">diff</a>) </li> <li><strong>severity</strong> → <span class="trac-field-new">Problem</span> </li> </ul> Ticket Steven Watanabe Thu, 08 Jan 2009 16:58:53 GMT status, resolution changed https://svn.boost.org/trac10/ticket/781#comment:4 https://svn.boost.org/trac10/ticket/781#comment:4 <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-old">None</span> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/50516" title="Add specializations of plain_return_type_2 for std::string. Fixes #781">[50516]</a>) Add specializations of plain_return_type_2 for std::string. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/781" title="#781: Bugs: Lambda: (_1 + &#34;y&#34;)(string(&#34;x&#34;)) Doesn't Compile (closed: fixed)">#781</a> </p> Ticket