Opened 13 years ago

Closed 11 years ago

#3289 closed Bugs (fixed)

boost::phoenix::lambda doesnt handle local variables very well.

Reported by: kuentang@… Owned by: Joel de Guzman
Milestone: Boost 1.40.0 Component: spirit
Version: Boost Development Trunk Severity: Problem
Keywords: spirit phoenix lambda Cc:

Description

Introducing a local variable in boost::phoenix::lambda without using an argument names create a compiler error with boost 1.40 and msvc 2008. To be precise: The code

double abc=lambda(_a=*ref(it)++)[_a*2.0]()(); here 'it' is an iterator

create a boost::phoenix::detail::error_expecting_arguments error. The problem seems to be connected to the no_nullary. the following code reproduce the error:

# include <algorithm> # include <vector>

# include <boost/spirit/include/phoenix.hpp>

using namespace boost::phoenix; using namespace boost::phoenix::arg_names; using namespace boost::phoenix::local_names;

int main() {

std::vector<double> u(11,1.0); std::vector<double> w(11,2.0); std::vector<double>::const_iterator it=w.begin(); boost::phoenix::generate(ref(u) ,lambda(_a=*ref(it)++)[_a*2.0 ] )();

double abc=lambda(_a=*ref(it)++)[_a*2.0]()(); return 0;

}

Change History (2)

comment:1 by Thomas Heller, 12 years ago

This is fixed in phoenix V3

comment:2 by Bryce Adelstein Lelbach, 11 years ago

Resolution: fixed
Status: newclosed

Fixed in phx v3.

Note: See TracTickets for help on using tickets.