bug8298.cpp 850 B

123456789101112131415161718192021222324252627282930313233
  1. /*=============================================================================
  2. Copyright (c) 2014 John Fletcher
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #include <boost/phoenix.hpp>
  7. #include <boost/detail/lightweight_test.hpp>
  8. namespace phoenix = boost::phoenix;
  9. using boost::phoenix::ref;
  10. using namespace phoenix::local_names;
  11. using boost::phoenix::arg_names::_1;
  12. int main(int argc, char *argv[])
  13. {
  14. int x = 17;
  15. int y = phoenix::lambda(_a=ref(x))
  16. [
  17. _a = 18
  18. ]()();
  19. BOOST_TEST(y==18);
  20. int z = phoenix::lambda(_a=_1)
  21. [
  22. _a = 18
  23. ](x)();
  24. std::cout << z << std::endl;
  25. BOOST_TEST(y==18);
  26. return boost::report_errors();
  27. }