Re: [Boost-bugs] [Boost C++ Libraries] #781: Lambda: (_1 + "y")(string("x")) Doesn't Compile

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #781: Lambda: (_1 + "y")(string("x")) Doesn't Compile
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-02-13 15:57:58


#781: Lambda: (_1 + "y")(string("x")) Doesn't Compile
---------------------+------------------------------------------------------
  Reporter: nobody | Owner: no-maintainer
      Type: Bugs | Status: new
 Milestone: | Component: lambda
   Version: None | Severity: Problem
Resolution: None | Keywords:
---------------------+------------------------------------------------------
Changes (by marshall):

  * owner: urzuga => no-maintainer
  * status: assigned => new
  * component: None => lambda
  * severity: => Problem

Old description:

> {{{
> This program:
>
> #include <iostream>
> #include <ostream>
> #include <string>
> #include <boost/lambda/lambda.hpp>
>
> int main() {
> const std::string s("Hello");
>
> std::cout << (boost::lambda::_1 + ", world!")(s) << 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<' should be deleted from line 269 (and the closing '>'
> 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.
> }}}

New description:

 {{{
 This program:

 #include <iostream>
 #include <ostream>
 #include <string>
 #include <boost/lambda/lambda.hpp>

 int main() {
     const std::string s("Hello");

     std::cout << (boost::lambda::_1 + ", world!")(s) << 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<' should be deleted from line 269 (and the closing '>'
 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.
 }}}

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/781#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC