summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/phoenix/test/scope
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/phoenix/test/scope')
-rw-r--r--src/boost/libs/phoenix/test/scope/bug3289.cpp37
-rw-r--r--src/boost/libs/phoenix/test/scope/bug8298.cpp33
-rw-r--r--src/boost/libs/phoenix/test/scope/bug8298f.cpp24
-rw-r--r--src/boost/libs/phoenix/test/scope/bug_000008.cpp105
-rw-r--r--src/boost/libs/phoenix/test/scope/dynamic_tests.cpp75
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests1.cpp23
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests10.cpp35
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests11.cpp33
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests12.cpp26
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests13.cpp28
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests14.cpp34
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests15.cpp34
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests16.cpp25
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests17.cpp27
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests18.cpp36
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests19.cpp41
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests2.cpp25
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests20.cpp29
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests21.cpp29
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests22.cpp30
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests23.cpp28
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests3.cpp25
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests4.cpp33
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests5.cpp27
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests6.cpp27
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests7.cpp34
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests8.cpp23
-rw-r--r--src/boost/libs/phoenix/test/scope/lambda_tests9.cpp25
-rw-r--r--src/boost/libs/phoenix/test/scope/let_tests.cpp204
-rw-r--r--src/boost/libs/phoenix/test/scope/let_tests_113.cpp204
-rw-r--r--src/boost/libs/phoenix/test/scope/let_tests_113a.cpp192
-rw-r--r--src/boost/libs/phoenix/test/scope/let_tests_157.cpp194
-rw-r--r--src/boost/libs/phoenix/test/scope/let_tests_157a.cpp191
-rw-r--r--src/boost/libs/phoenix/test/scope/let_tests_rest.cpp192
-rw-r--r--src/boost/libs/phoenix/test/scope/more_lambda_tests.cpp48
-rw-r--r--src/boost/libs/phoenix/test/scope/more_let_tests.cpp156
-rw-r--r--src/boost/libs/phoenix/test/scope/more_let_tests1.cpp136
-rw-r--r--src/boost/libs/phoenix/test/scope/more_let_tests2.cpp125
-rw-r--r--src/boost/libs/phoenix/test/scope/more_let_tests2a.cpp126
-rw-r--r--src/boost/libs/phoenix/test/scope/more_let_tests2b.cpp136
-rw-r--r--src/boost/libs/phoenix/test/scope/this.cpp124
41 files changed, 2979 insertions, 0 deletions
diff --git a/src/boost/libs/phoenix/test/scope/bug3289.cpp b/src/boost/libs/phoenix/test/scope/bug3289.cpp
new file mode 100644
index 000000000..f54d5e1d5
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/bug3289.cpp
@@ -0,0 +1,37 @@
+/*==============================================================================
+ Copyright (c) 2005-2010 Joel de Guzman
+ Copyright (c) 2010 Thomas Heller
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <algorithm>
+#include <vector>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/scope.hpp>
+#include <boost/phoenix/stl.hpp>
+
+namespace phx = boost::phoenix;
+using namespace boost::phoenix;
+using namespace boost::phoenix::arg_names;
+using namespace boost::phoenix::local_names;
+
+int main()
+{
+ std::vector<int> u(11,1);
+ std::vector<int> w(11,2);
+ std::vector<int>::const_iterator it=w.begin();
+
+ boost::phoenix::generate(phx::ref(u), lambda(_a=*phx::ref(it)++)[_a*2])();
+
+ BOOST_TEST(std::accumulate(u.begin(), u.end(), 0) == 44);
+
+ BOOST_TEST(lambda(_a=*phx::ref(it)++)[_a*2]()() == 4);
+
+ return boost::report_errors();
+}
+
+
diff --git a/src/boost/libs/phoenix/test/scope/bug8298.cpp b/src/boost/libs/phoenix/test/scope/bug8298.cpp
new file mode 100644
index 000000000..42cd8ab64
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/bug8298.cpp
@@ -0,0 +1,33 @@
+/*=============================================================================
+ Copyright (c) 2014 John Fletcher
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#include <boost/phoenix.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+
+namespace phoenix = boost::phoenix;
+using boost::phoenix::ref;
+using namespace phoenix::local_names;
+using boost::phoenix::arg_names::_1;
+
+int main(int argc, char *argv[])
+{
+ int x = 17;
+ int y = phoenix::lambda(_a=ref(x))
+ [
+ _a = 18
+ ]()();
+ BOOST_TEST(y==18);
+
+ int z = phoenix::lambda(_a=_1)
+ [
+ _a = 18
+ ](x)();
+ std::cout << z << std::endl;
+ BOOST_TEST(y==18);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/bug8298f.cpp b/src/boost/libs/phoenix/test/scope/bug8298f.cpp
new file mode 100644
index 000000000..ad7327efa
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/bug8298f.cpp
@@ -0,0 +1,24 @@
+/*=============================================================================
+ Copyright (c) 2014 John Fletcher
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#include <boost/phoenix.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+
+namespace phoenix = boost::phoenix;
+using namespace phoenix::local_names;
+using boost::phoenix::arg_names::_1;
+
+int main(int argc, char *argv[])
+{
+ int y = phoenix::lambda(_a=_1)
+ [
+ _a = 18
+ ](17)();
+ BOOST_TEST(y==18);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/bug_000008.cpp b/src/boost/libs/phoenix/test/scope/bug_000008.cpp
new file mode 100644
index 000000000..58adf4171
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/bug_000008.cpp
@@ -0,0 +1,105 @@
+/*=============================================================================
+ Copyright (c) 2003 Martin Wille
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2015 John Fletcher
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+ // see http://article.gmane.org/gmane.comp.parsers.spirit.general/4575
+ // or https://sf.net/mailarchive/forum.php?thread_id=2692308&forum_id=1595
+ // for a description of the bug being tested for by this program
+ //
+ // This code is borrowed from Spirit's bug_000008.cpp test for multithreads.
+ // Now modified to point to the Phoenix headers
+ // instead of the ones in Spirit.
+#include <iostream>
+#include <boost/config.hpp>
+#include <boost/assert.hpp>
+#include <boost/detail/lightweight_test.hpp>
+ // Testing problems in thread/future
+//#include <boost/move/move.hpp>
+//#include <boost/move/detail/type_traits.hpp>
+//using boost::move_detail::is_copy_constructible;
+#include <boost/phoenix/scope/dynamic.hpp>
+
+#if defined(DONT_HAVE_BOOST) \
+ || !defined(BOOST_HAS_THREADS) \
+ || defined(BOOST_DISABLE_THREADS) \
+ || (defined(__GNUC__) && defined(__WIN32__)) // MinGW
+#define SKIP_TEST
+#endif
+
+
+#if defined(SKIP_TEST)
+// we end here if we can't do multithreading
+static void skipped()
+{
+ std::cout << "skipped\n";
+}
+
+int
+main()
+{
+ skipped();
+ return boost::report_errors();
+}
+
+#else
+// the real MT stuff
+
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/scope.hpp>
+#include <boost/thread.hpp>
+
+static const int number_of_calls_per_thread=20000;
+
+struct test_dynamic : boost::phoenix::dynamic<int>
+{
+ // test_dynamic() : b(*this) {}
+ test_dynamic() : b(init<0>(this)) {}
+ member1 b;
+};
+
+void
+in_thread(void)
+{
+ test_dynamic s; // should now be a local
+
+ for (int i = 0; i < number_of_calls_per_thread; ++i)
+ {
+ boost::phoenix::dynamic_frame<test_dynamic::self_type> frame(s);
+ (s.b = 123)();
+ {
+ boost::phoenix::dynamic_frame<test_dynamic::self_type> frame(s);
+ (s.b = 456)();
+ BOOST_ASSERT((s.b == 456)());
+ }
+ BOOST_ASSERT((s.b == 123)());
+ }
+}
+
+void
+bug_000008()
+{
+ boost::thread t1(in_thread);
+ boost::thread t2(in_thread);
+ boost::thread t3(in_thread);
+ boost::thread t4(in_thread);
+
+ t1.join();
+ t2.join();
+ t3.join();
+ t4.join();
+}
+
+int
+main()
+{
+ bug_000008();
+ return boost::report_errors();
+}
+
+#endif
+
diff --git a/src/boost/libs/phoenix/test/scope/dynamic_tests.cpp b/src/boost/libs/phoenix/test/scope/dynamic_tests.cpp
new file mode 100644
index 000000000..8751d1814
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/dynamic_tests.cpp
@@ -0,0 +1,75 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <string>
+#include <cmath>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/scope/dynamic.hpp>
+
+struct my_dynamic : ::boost::phoenix::dynamic<int, std::string, double>
+{
+ my_dynamic() : num(init<0>(this)), message(init<1>(this)), real(init<2>(this)) {}
+
+ member1 num;
+ member2 message;
+ member3 real;
+};
+
+// You may also use the macro below to achieve the same as above:
+//
+//BOOST_PHOENIX_DYNAMIC(
+// my_dynamic,
+// (int, num)
+// (std::string, message)
+// (double, real)
+//);
+
+int
+main()
+{
+ using namespace boost::phoenix;
+ using namespace boost::phoenix::arg_names;
+
+ my_dynamic clos;
+
+ { // First stack frame
+ dynamic_frame<my_dynamic::self_type> frame(clos);
+ (clos.num = 123)();
+ (clos.num += 456)();
+ (clos.real = clos.num / 56.5)();
+ (clos.message = "Hello " + std::string("World "))();
+
+ { // Second stack frame
+ dynamic_frame<my_dynamic::self_type> frame(clos);
+ (clos.num = 987)();
+ (clos.message = std::string("Abracadabra "))();
+ (clos.real = clos.num * 1e30)();
+
+ { // Third stack frame
+ boost::phoenix::vector3<int, std::string, double> init = {-1, "Direct Init ", 3.14};
+ dynamic_frame<my_dynamic::self_type> frame(clos, init);
+
+ (std::cout << clos.message << clos.num << ", " << clos.real << '\n')();
+ BOOST_TEST(clos.num() == -1);
+ BOOST_TEST(clos.message() == "Direct Init ");
+ }
+
+ (std::cout << clos.message << clos.num << ", " << clos.real << '\n')();
+ BOOST_TEST(clos.num() == 987);
+ BOOST_TEST(clos.message() == "Abracadabra ");
+ }
+
+ (std::cout << clos.message << clos.num << ", " << clos.real << '\n')();
+ BOOST_TEST(clos.num() == 123+456);
+ BOOST_TEST(clos.message() == "Hello " + std::string("World "));
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests1.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests1.cpp
new file mode 100644
index 000000000..4c3b4e7a7
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests1.cpp
@@ -0,0 +1,23 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+
+ int x = 1;
+ int y = lambda[_1]()(x);
+ BOOST_TEST(x == y);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests10.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests10.cpp
new file mode 100644
index 000000000..27b6f1696
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests10.cpp
@@ -0,0 +1,35 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+struct zzz {};
+
+int main()
+{
+#if defined(RUNNING_ON_APPVEYOR) && BOOST_WORKAROUND(BOOST_MSVC, == 1800)
+ // skip test
+#else
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 1;
+ char const* y = "hello";
+ zzz z;
+ BOOST_TEST(lambda(_a = _1)[lambda[_a]](x)(y)(z) == x);
+
+ return boost::report_errors();
+#endif
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests11.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests11.cpp
new file mode 100644
index 000000000..35fb8ce4c
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests11.cpp
@@ -0,0 +1,33 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+#if defined(RUNNING_ON_APPVEYOR) && BOOST_WORKAROUND(BOOST_MSVC, == 1800)
+ // skip test
+#else
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 1;
+ char const* y = "hello";
+ int xx = 20;
+ BOOST_TEST(lambda(_a = _1)[lambda[_a]](x)(y)(xx) == x);
+
+ return boost::report_errors();
+#endif
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests12.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests12.cpp
new file mode 100644
index 000000000..f355b313d
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests12.cpp
@@ -0,0 +1,26 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 1;
+ char const* y = "hello";
+ BOOST_TEST(lambda(_a = _1)[lambda[_a + _1]](x)(y)(x) == 2);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests13.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests13.cpp
new file mode 100644
index 000000000..57c0a52ec
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests13.cpp
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+
+ int x = 1;
+ long x2 = 2;
+ short x3 = 3;
+ BOOST_TEST(lambda(_a = _1)[lambda(_b = _1)[_a + _b + _1]](x)(x2)(x3) == 6);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests14.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests14.cpp
new file mode 100644
index 000000000..b504bf299
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests14.cpp
@@ -0,0 +1,34 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+#if defined(RUNNING_ON_APPVEYOR) && BOOST_WORKAROUND(BOOST_MSVC, == 1800)
+ // skip test
+#else
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 1, y = 10;
+ BOOST_TEST(
+ (_1 + lambda(_a = _1)[_a + lambda[_a + 2]])(x)(y)(y) == 1+1+1+2
+ );
+
+ return boost::report_errors();
+#endif
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests15.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests15.cpp
new file mode 100644
index 000000000..c2d083136
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests15.cpp
@@ -0,0 +1,34 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahshi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+#if defined(RUNNING_ON_APPVEYOR) && BOOST_WORKAROUND(BOOST_MSVC, == 1800)
+ // skip test
+#else
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 1, y = 10;
+ BOOST_TEST(
+ (_1 + lambda(_a = _1)[_a + lambda[_a + 2]])(x)()(x) == 1+1+1+2
+ );
+
+ return boost::report_errors();
+#endif
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests16.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests16.cpp
new file mode 100644
index 000000000..0ca0301f1
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests16.cpp
@@ -0,0 +1,25 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+
+ int x = 1, y = 10;
+ BOOST_TEST(
+ (_1 + _1 + lambda[_1 + 2])(x)(y) == 1+1+10+2
+ );
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests17.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests17.cpp
new file mode 100644
index 000000000..137bb95ca
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests17.cpp
@@ -0,0 +1,27 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahsahi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 1, y = 10;
+ BOOST_TEST(
+ (_1 + lambda(_a = _1)[_a + _1 + 2])(x)(y) == 1+1+10+2
+ );
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests18.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests18.cpp
new file mode 100644
index 000000000..fc3b30250
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests18.cpp
@@ -0,0 +1,36 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahsahi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <vector>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+#include <boost/phoenix/stl/algorithm/iteration.hpp>
+#include <boost/phoenix/stl/container.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::for_each;
+
+ int init[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ std::vector<int> v(init, init+10);
+
+ int x = 0;
+ for_each(_1, lambda(_a = _2)[_a += _1])(v, x);
+ BOOST_TEST(x == 55);
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests19.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests19.cpp
new file mode 100644
index 000000000..c2002f6a8
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests19.cpp
@@ -0,0 +1,41 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahsahi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <vector>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+#include <boost/phoenix/stl/algorithm/iteration.hpp>
+#include <boost/phoenix/stl/container.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::ref;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::placeholders::arg1;
+
+ using boost::phoenix::for_each;
+ using boost::phoenix::push_back;
+
+ int x = 10;
+ std::vector<std::vector<int> > v(10);
+ for_each(_1, lambda(_a = _2)[push_back(_1, _a)])(v, x);
+
+ int y = 0;
+ for_each(arg1, lambda[ref(y) += _1[0]])(v);
+ BOOST_TEST(y == 100);
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests2.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests2.cpp
new file mode 100644
index 000000000..8c5029922
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests2.cpp
@@ -0,0 +1,25 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+
+ int x = 1, y = 10;
+ BOOST_TEST(
+ (_1 + lambda[_1 + 2])(x)(y) == 1+10+2
+ );
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests20.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests20.cpp
new file mode 100644
index 000000000..29e42ad3f
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests20.cpp
@@ -0,0 +1,29 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+
+ int x = 1, y = 10, z = 13;
+ BOOST_TEST(
+ lambda(_a = _1, _b = _2)[_1 + _a + _b](x, z)(y) == x + y + z
+ );
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests21.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests21.cpp
new file mode 100644
index 000000000..493b1d3e3
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests21.cpp
@@ -0,0 +1,29 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+#include <boost/phoenix/scope/let.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::let;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+
+ int i = 0;
+ int j = 2;
+ BOOST_TEST(lambda[let(_a = _1)[_a = _2]]()(i, j) == j);
+ BOOST_TEST(i == j);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests22.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests22.cpp
new file mode 100644
index 000000000..859d27223
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests22.cpp
@@ -0,0 +1,30 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/bind.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+#include <boost/phoenix/scope/let.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::local_names::_a;
+
+ int x = (let(_a = lambda[val(1)])[bind(_a)])();
+ BOOST_TEST(x == 1);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests23.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests23.cpp
new file mode 100644
index 000000000..62d7f92c3
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests23.cpp
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/bind.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+#include <boost/phoenix/scope/let.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = (let(_a = _1)[bind(_a)])(lambda[val(1)]());
+ BOOST_TEST(x == 1);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests3.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests3.cpp
new file mode 100644
index 000000000..dea0ccc3b
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests3.cpp
@@ -0,0 +1,25 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+
+ int x = 1, y = 10;
+ BOOST_TEST(
+ (_1 + lambda[-_1])(x)(y) == 1+-10
+ );
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests4.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests4.cpp
new file mode 100644
index 000000000..1e253569a
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests4.cpp
@@ -0,0 +1,33 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+
+ int x = 1, y = 10, z = 13;
+ BOOST_TEST(
+ lambda(_a = _1, _b = _2)
+ [
+ _1 + _a + _b
+ ]
+ (x, z)(y) == x + y + z
+ );
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests5.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests5.cpp
new file mode 100644
index 000000000..564980b4f
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests5.cpp
@@ -0,0 +1,27 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 4;
+ int y = 5;
+ lambda(_a = _1)[_a = 555](x)();
+ BOOST_TEST(x == 555);
+ (void)y;
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests6.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests6.cpp
new file mode 100644
index 000000000..47535e652
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests6.cpp
@@ -0,0 +1,27 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 1, y = 10;
+ BOOST_TEST(
+ (_1 + lambda(_a = _1)[_a + _1 + 2])(x)(y) == 1+1+10+2
+ );
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests7.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests7.cpp
new file mode 100644
index 000000000..815485ddf
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests7.cpp
@@ -0,0 +1,34 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/arithmetic.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+#if defined(RUNNING_ON_APPVEYOR) && BOOST_WORKAROUND(BOOST_MSVC, == 1800)
+ // skip test
+#else
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 1, y = 10;
+ BOOST_TEST(
+ (_1 + lambda(_a = _1)[_a + lambda[_a + 2]])(x)(y)(y) == 1+1+1+2
+ );
+
+ return boost::report_errors();
+#endif
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests8.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests8.cpp
new file mode 100644
index 000000000..6f0a25451
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests8.cpp
@@ -0,0 +1,23 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+
+ int x = 1;
+ char const* y = "hello";
+ BOOST_TEST(lambda[_1](x)(y) == y);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/lambda_tests9.cpp b/src/boost/libs/phoenix/test/scope/lambda_tests9.cpp
new file mode 100644
index 000000000..bd7fe30b6
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/lambda_tests9.cpp
@@ -0,0 +1,25 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2014 John Fletcher
+ Copyright (c) 2018 Kohei Takahashi
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator/self.hpp>
+#include <boost/phoenix/scope/lambda.hpp>
+
+int main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+
+ int x = 1;
+ char const* y = "hello";
+ BOOST_TEST(lambda(_a = _1)[_a](x)(y) == x);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/let_tests.cpp b/src/boost/libs/phoenix/test/scope/let_tests.cpp
new file mode 100644
index 000000000..26fa916fc
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/let_tests.cpp
@@ -0,0 +1,204 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+#include <boost/phoenix/object/construct.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::arg_names::_3;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+ using boost::phoenix::local_names::_c;
+ using boost::phoenix::local_names::_d;
+ using boost::phoenix::local_names::_e;
+ using boost::phoenix::local_names::_x;
+ using boost::phoenix::local_names::_y;
+ using boost::phoenix::local_names::_z;
+ using boost::phoenix::placeholders::arg1;
+
+ {
+ int x = 1;
+ BOOST_TEST(
+ let(_a = _1)
+ [
+ _a
+ ]
+ (x) == x
+ )
+ ;
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_a = _1, _b = _2)
+ [
+ _a + _b
+ ]
+ (x, y) == x + y
+ );
+ }
+
+ {
+ int x = 1, y = 10, z = 13;
+ BOOST_TEST(
+ let(_x = _1, _y = _2)
+ [
+ let(_z = _3)
+ [
+ _x + _y + _z
+ ]
+ ]
+ (x, y, z) == x + y + z
+ );
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_x = _1)
+ [
+ _x +
+ let(_x = _2)
+ [
+ -_x
+ ]
+ ]
+ (x, y) == x + -y
+ );
+ }
+
+ {
+ int x = 999;
+ BOOST_TEST(
+ let(_x = _1) // _x is a reference to x
+ [
+ _x += 888
+ ]
+ (x) == 999 + 888
+ );
+
+ BOOST_TEST(x == 888 + 999);
+ }
+
+ {
+ int x = 999;
+ /*
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ _x += 888
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+ */
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ val(_x += 888)
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+ }
+
+ {
+ BOOST_TEST(
+ let(_a = 1, _b = 2, _c = 3, _d = 4, _e = 5)
+ [
+ _a + _b + _c + _d + _e
+ ]
+ () == 1 + 2 + 3 + 4 + 5
+ );
+ }
+
+#ifdef PHOENIX_SHOULD_NOT_COMPILE_TEST
+ {
+ // disallow this:
+ int i;
+ (_a + _b)(i);
+ }
+#endif
+
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+#if defined(__OPTIMIZE__) && __OPTIMIZE__
+ int x = (let(_a = _2)[let(_b = _1)[ _a ]])(y,1);
+#else
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+#endif
+ BOOST_TEST(x == 1);
+ }
+
+ {
+ // show that this code returns an lvalue
+ int i = 1;
+ let(_a = arg1)[ _a ](i)++;
+ BOOST_TEST(i == 2);
+ }
+
+ {
+ // show that what you put in is what you get out
+ int i = 1;
+ int& j = let(_a = arg1)[_a](i);
+ BOOST_TEST(&i == &j);
+ }
+
+ {
+ // show that a let with a void result can compile
+ using boost::phoenix::construct;
+
+ let(_a = 1)[ // need at least one expression here
+ construct<void>() // produce a void result
+ ]();
+ }
+
+ {
+ using boost::phoenix::at_c;
+
+ boost::fusion::tuple<int, int> t = boost::fusion::make_tuple(0, 1);
+ int i = let(_a = at_c<0>(_1))[_a](t);
+
+ BOOST_TEST( i == 0 );
+ }
+
+ {
+ int i = 0;
+ let(_a = _1)[_a = _2](i, 2);
+ BOOST_TEST(i == 2);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/let_tests_113.cpp b/src/boost/libs/phoenix/test/scope/let_tests_113.cpp
new file mode 100644
index 000000000..c8ebea171
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/let_tests_113.cpp
@@ -0,0 +1,204 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2015 John Fletcher
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::ref;
+ using boost::phoenix::arg_names::_1;
+ //using boost::phoenix::arg_names::_2;
+ //using boost::phoenix::arg_names::_3;
+ //using boost::phoenix::local_names::_a;
+ //using boost::phoenix::local_names::_b;
+ //using boost::phoenix::local_names::_c;
+ //using boost::phoenix::local_names::_d;
+ //using boost::phoenix::local_names::_e;
+ using boost::phoenix::local_names::_x;
+ //using boost::phoenix::local_names::_y;
+ //using boost::phoenix::local_names::_z;
+ //using boost::phoenix::placeholders::arg1;
+ /*
+ {
+ int x = 1;
+ BOOST_TEST(
+ let(_a = _1)
+ [
+ _a
+ ]
+ (x) == x
+ )
+ ;
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_a = _1, _b = _2)
+ [
+ _a + _b
+ ]
+ (x, y) == x + y
+ );
+ }
+
+ {
+ int x = 1, y = 10, z = 13;
+ BOOST_TEST(
+ let(_x = _1, _y = _2)
+ [
+ let(_z = _3)
+ [
+ _x + _y + _z
+ ]
+ ]
+ (x, y, z) == x + y + z
+ );
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_x = _1)
+ [
+ _x +
+ let(_x = _2)
+ [
+ -_x
+ ]
+ ]
+ (x, y) == x + -y
+ );
+ }
+
+ {
+ int x = 999;
+ BOOST_TEST(
+ let(_x = _1) // _x is a reference to x
+ [
+ _x += 888
+ ]
+ (x) == 999 + 888
+ );
+
+ BOOST_TEST(x == 888 + 999);
+ }
+ */
+ {
+ int x = 999;
+
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ val(_x += 888) // so use value here too.
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+ /*
+ BOOST_TEST(
+ let(_x = ref(_1)) // _x holds x by reference
+ [
+ _x += 888
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+ */
+
+ BOOST_TEST(
+ let( _x = _1 ) // _x holds x by reference
+ [
+ _x += 888
+ ]
+ (x) == 999 + 888
+ );
+
+ BOOST_TEST(x == 888 + 999);
+ }
+ /*
+ {
+ BOOST_TEST(
+ let(_a = 1, _b = 2, _c = 3, _d = 4, _e = 5)
+ [
+ _a + _b + _c + _d + _e
+ ]
+ () == 1 + 2 + 3 + 4 + 5
+ );
+ }
+
+#ifdef PHOENIX_SHOULD_NOT_COMPILE_TEST
+ {
+ // disallow this:
+ int i;
+ (_a + _b)(i);
+ }
+#endif
+
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+
+ {
+ // show that this code returns an lvalue
+ int i = 1;
+ let(_a = arg1)[ _a ](i)++;
+ BOOST_TEST(i == 2);
+ }
+
+ {
+ // show that what you put in is what you get out
+ int i = 1;
+ int& j = let(_a = arg1)[_a](i);
+ BOOST_TEST(&i == &j);
+ }
+
+ {
+ using boost::phoenix::at_c;
+
+ boost::fusion::tuple<int, int> t = boost::fusion::make_tuple(0, 1);
+ int i = let(_a = at_c<0>(_1))[_a](t);
+
+ BOOST_TEST( i == 0 );
+ }
+
+ {
+ int i = 0;
+ let(_a = _1)[_a = _2](i, 2);
+ BOOST_TEST(i == 2);
+ }
+ */
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/let_tests_113a.cpp b/src/boost/libs/phoenix/test/scope/let_tests_113a.cpp
new file mode 100644
index 000000000..6d84e4848
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/let_tests_113a.cpp
@@ -0,0 +1,192 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2015 John Fletcher
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ //using boost::phoenix::arg_names::_2;
+ //using boost::phoenix::arg_names::_3;
+ //using boost::phoenix::local_names::_a;
+ //using boost::phoenix::local_names::_b;
+ //using boost::phoenix::local_names::_c;
+ //using boost::phoenix::local_names::_d;
+ //using boost::phoenix::local_names::_e;
+ using boost::phoenix::local_names::_x;
+ //using boost::phoenix::local_names::_y;
+ //using boost::phoenix::local_names::_z;
+ //using boost::phoenix::placeholders::arg1;
+ /*
+ {
+ int x = 1;
+ BOOST_TEST(
+ let(_a = _1)
+ [
+ _a
+ ]
+ (x) == x
+ )
+ ;
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_a = _1, _b = _2)
+ [
+ _a + _b
+ ]
+ (x, y) == x + y
+ );
+ }
+
+ {
+ int x = 1, y = 10, z = 13;
+ BOOST_TEST(
+ let(_x = _1, _y = _2)
+ [
+ let(_z = _3)
+ [
+ _x + _y + _z
+ ]
+ ]
+ (x, y, z) == x + y + z
+ );
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_x = _1)
+ [
+ _x +
+ let(_x = _2)
+ [
+ -_x
+ ]
+ ]
+ (x, y) == x + -y
+ );
+ }
+
+ {
+ int x = 999;
+ BOOST_TEST(
+ let(_x = _1) // _x is a reference to x
+ [
+ _x += 888
+ ]
+ (x) == 999 + 888
+ );
+
+ BOOST_TEST(x == 888 + 999);
+ }
+ */
+ {
+ int x = 999;
+
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ val(_x += 888)
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+ /*
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ val(_x += 888)
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999); */
+ }
+ /*
+ {
+ BOOST_TEST(
+ let(_a = 1, _b = 2, _c = 3, _d = 4, _e = 5)
+ [
+ _a + _b + _c + _d + _e
+ ]
+ () == 1 + 2 + 3 + 4 + 5
+ );
+ }
+
+#ifdef PHOENIX_SHOULD_NOT_COMPILE_TEST
+ {
+ // disallow this:
+ int i;
+ (_a + _b)(i);
+ }
+#endif
+
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+
+ {
+ // show that this code returns an lvalue
+ int i = 1;
+ let(_a = arg1)[ _a ](i)++;
+ BOOST_TEST(i == 2);
+ }
+
+ {
+ // show that what you put in is what you get out
+ int i = 1;
+ int& j = let(_a = arg1)[_a](i);
+ BOOST_TEST(&i == &j);
+ }
+
+ {
+ using boost::phoenix::at_c;
+
+ boost::fusion::tuple<int, int> t = boost::fusion::make_tuple(0, 1);
+ int i = let(_a = at_c<0>(_1))[_a](t);
+
+ BOOST_TEST( i == 0 );
+ }
+
+ {
+ int i = 0;
+ let(_a = _1)[_a = _2](i, 2);
+ BOOST_TEST(i == 2);
+ }
+ */
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/let_tests_157.cpp b/src/boost/libs/phoenix/test/scope/let_tests_157.cpp
new file mode 100644
index 000000000..7979cea4f
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/let_tests_157.cpp
@@ -0,0 +1,194 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ //using boost::phoenix::arg_names::_3;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+ //using boost::phoenix::local_names::_c;
+ //using boost::phoenix::local_names::_d;
+ //using boost::phoenix::local_names::_e;
+ //using boost::phoenix::local_names::_x;
+ //using boost::phoenix::local_names::_y;
+ //using boost::phoenix::local_names::_z;
+ //using boost::phoenix::placeholders::arg1;
+ /*
+ {
+ int x = 1;
+ BOOST_TEST(
+ let(_a = _1)
+ [
+ _a
+ ]
+ (x) == x
+ )
+ ;
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_a = _1, _b = _2)
+ [
+ _a + _b
+ ]
+ (x, y) == x + y
+ );
+ }
+
+ {
+ int x = 1, y = 10, z = 13;
+ BOOST_TEST(
+ let(_x = _1, _y = _2)
+ [
+ let(_z = _3)
+ [
+ _x + _y + _z
+ ]
+ ]
+ (x, y, z) == x + y + z
+ );
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_x = _1)
+ [
+ _x +
+ let(_x = _2)
+ [
+ -_x
+ ]
+ ]
+ (x, y) == x + -y
+ );
+ }
+
+ {
+ int x = 999;
+ BOOST_TEST(
+ let(_x = _1) // _x is a reference to x
+ [
+ _x += 888
+ ]
+ (x) == 999 + 888
+ );
+
+ BOOST_TEST(x == 888 + 999);
+ }
+
+ {
+ int x = 999;
+
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ _x += 888
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ val(_x += 888)
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+ }
+
+ {
+ BOOST_TEST(
+ let(_a = 1, _b = 2, _c = 3, _d = 4, _e = 5)
+ [
+ _a + _b + _c + _d + _e
+ ]
+ () == 1 + 2 + 3 + 4 + 5
+ );
+ }
+
+#ifdef PHOENIX_SHOULD_NOT_COMPILE_TEST
+ {
+ // disallow this:
+ int i;
+ (_a + _b)(i);
+ }
+#endif
+ */
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+#if defined(__OPTIMIZE__) && __OPTIMIZE__
+ int x = (let(_a = _2)[let(_b = _1)[ _a ]])(y,1);
+#else
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+#endif
+ BOOST_TEST(x == 1);
+ }
+ /*
+ {
+ // show that this code returns an lvalue
+ int i = 1;
+ let(_a = arg1)[ _a ](i)++;
+ BOOST_TEST(i == 2);
+ }
+
+ {
+ // show that what you put in is what you get out
+ int i = 1;
+ int& j = let(_a = arg1)[_a](i);
+ BOOST_TEST(&i == &j);
+ }
+
+ {
+ using boost::phoenix::at_c;
+
+ boost::fusion::tuple<int, int> t = boost::fusion::make_tuple(0, 1);
+ int i = let(_a = at_c<0>(_1))[_a](t);
+
+ BOOST_TEST( i == 0 );
+ }
+
+ {
+ int i = 0;
+ let(_a = _1)[_a = _2](i, 2);
+ BOOST_TEST(i == 2);
+ }
+ */
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/let_tests_157a.cpp b/src/boost/libs/phoenix/test/scope/let_tests_157a.cpp
new file mode 100644
index 000000000..83dd33ac8
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/let_tests_157a.cpp
@@ -0,0 +1,191 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ //using boost::phoenix::arg_names::_3;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+ //using boost::phoenix::local_names::_c;
+ //using boost::phoenix::local_names::_d;
+ //using boost::phoenix::local_names::_e;
+ //using boost::phoenix::local_names::_x;
+ //using boost::phoenix::local_names::_y;
+ //using boost::phoenix::local_names::_z;
+ //using boost::phoenix::placeholders::arg1;
+ /*
+ {
+ int x = 1;
+ BOOST_TEST(
+ let(_a = _1)
+ [
+ _a
+ ]
+ (x) == x
+ )
+ ;
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_a = _1, _b = _2)
+ [
+ _a + _b
+ ]
+ (x, y) == x + y
+ );
+ }
+
+ {
+ int x = 1, y = 10, z = 13;
+ BOOST_TEST(
+ let(_x = _1, _y = _2)
+ [
+ let(_z = _3)
+ [
+ _x + _y + _z
+ ]
+ ]
+ (x, y, z) == x + y + z
+ );
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_x = _1)
+ [
+ _x +
+ let(_x = _2)
+ [
+ -_x
+ ]
+ ]
+ (x, y) == x + -y
+ );
+ }
+
+ {
+ int x = 999;
+ BOOST_TEST(
+ let(_x = _1) // _x is a reference to x
+ [
+ _x += 888
+ ]
+ (x) == 999 + 888
+ );
+
+ BOOST_TEST(x == 888 + 999);
+ }
+
+ {
+ int x = 999;
+
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ _x += 888
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ val(_x += 888)
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+ }
+
+ {
+ BOOST_TEST(
+ let(_a = 1, _b = 2, _c = 3, _d = 4, _e = 5)
+ [
+ _a + _b + _c + _d + _e
+ ]
+ () == 1 + 2 + 3 + 4 + 5
+ );
+ }
+
+#ifdef PHOENIX_SHOULD_NOT_COMPILE_TEST
+ {
+ // disallow this:
+ int i;
+ (_a + _b)(i);
+ }
+#endif
+ */
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+ int x = (let(_a = _2)[let(_b = _1)[ _a ]])(y,1);
+
+ BOOST_TEST(x == 1);
+ }
+ /*
+ {
+ // show that this code returns an lvalue
+ int i = 1;
+ let(_a = arg1)[ _a ](i)++;
+ BOOST_TEST(i == 2);
+ }
+
+ {
+ // show that what you put in is what you get out
+ int i = 1;
+ int& j = let(_a = arg1)[_a](i);
+ BOOST_TEST(&i == &j);
+ }
+
+ {
+ using boost::phoenix::at_c;
+
+ boost::fusion::tuple<int, int> t = boost::fusion::make_tuple(0, 1);
+ int i = let(_a = at_c<0>(_1))[_a](t);
+
+ BOOST_TEST( i == 0 );
+ }
+
+ {
+ int i = 0;
+ let(_a = _1)[_a = _2](i, 2);
+ BOOST_TEST(i == 2);
+ }
+ */
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/let_tests_rest.cpp b/src/boost/libs/phoenix/test/scope/let_tests_rest.cpp
new file mode 100644
index 000000000..9200d31d9
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/let_tests_rest.cpp
@@ -0,0 +1,192 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2015 John Fletcher
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::arg_names::_3;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+ using boost::phoenix::local_names::_c;
+ using boost::phoenix::local_names::_d;
+ using boost::phoenix::local_names::_e;
+ using boost::phoenix::local_names::_x;
+ using boost::phoenix::local_names::_y;
+ using boost::phoenix::local_names::_z;
+ using boost::phoenix::placeholders::arg1;
+
+ {
+ int x = 1;
+ BOOST_TEST(
+ let(_a = _1)
+ [
+ _a
+ ]
+ (x) == x
+ )
+ ;
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_a = _1, _b = _2)
+ [
+ _a + _b
+ ]
+ (x, y) == x + y
+ );
+ }
+
+ {
+ int x = 1, y = 10, z = 13;
+ BOOST_TEST(
+ let(_x = _1, _y = _2)
+ [
+ let(_z = _3)
+ [
+ _x + _y + _z
+ ]
+ ]
+ (x, y, z) == x + y + z
+ );
+ }
+
+ {
+ int x = 1, y = 10;
+ BOOST_TEST(
+ let(_x = _1)
+ [
+ _x +
+ let(_x = _2)
+ [
+ -_x
+ ]
+ ]
+ (x, y) == x + -y
+ );
+ }
+
+ {
+ int x = 999;
+ BOOST_TEST(
+ let(_x = _1) // _x is a reference to x
+ [
+ _x += 888
+ ]
+ (x) == 999 + 888
+ );
+
+ BOOST_TEST(x == 888 + 999);
+ }
+ /*
+ {
+ int x = 999;
+
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ _x += 888
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+
+ BOOST_TEST(
+ let(_x = val(_1)) // _x holds x by value
+ [
+ val(_x += 888)
+ ]
+ (x) == x + 888
+ );
+
+ BOOST_TEST(x == 999);
+ }
+ */
+ {
+ BOOST_TEST(
+ let(_a = 1, _b = 2, _c = 3, _d = 4, _e = 5)
+ [
+ _a + _b + _c + _d + _e
+ ]
+ () == 1 + 2 + 3 + 4 + 5
+ );
+ }
+
+#ifdef PHOENIX_SHOULD_NOT_COMPILE_TEST
+ {
+ // disallow this:
+ int i;
+ (_a + _b)(i);
+ }
+#endif
+ /*
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ */
+ {
+ // show that this code returns an lvalue
+ int i = 1;
+ let(_a = arg1)[ _a ](i)++;
+ BOOST_TEST(i == 2);
+ }
+
+ {
+ // show that what you put in is what you get out
+ int i = 1;
+ int& j = let(_a = arg1)[_a](i);
+ BOOST_TEST(&i == &j);
+ }
+
+ {
+ using boost::phoenix::at_c;
+
+ boost::fusion::tuple<int, int> t = boost::fusion::make_tuple(0, 1);
+ int i = let(_a = at_c<0>(_1))[_a](t);
+
+ BOOST_TEST( i == 0 );
+ }
+
+ {
+ int i = 0;
+ let(_a = _1)[_a = _2](i, 2);
+ BOOST_TEST(i == 2);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/more_lambda_tests.cpp b/src/boost/libs/phoenix/test/scope/more_lambda_tests.cpp
new file mode 100644
index 000000000..ea9209dc7
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/more_lambda_tests.cpp
@@ -0,0 +1,48 @@
+/*=============================================================================
+ Copyright (c) 2014 John Fletcher
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/bind.hpp>
+#include <boost/phoenix/scope.hpp>
+
+
+int
+main()
+{
+ using boost::phoenix::lambda;
+ using boost::phoenix::let;
+ using boost::phoenix::ref;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ //using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+ // using boost::phoenix::local_names::_b;
+ //using boost::phoenix::placeholders::arg1;
+
+ {
+ int x = 1;
+ int y = lambda[_1]()(x);
+ BOOST_TEST(x == y);
+ }
+
+ {
+ int x = 1;
+ int y = lambda(_a = _1)[_a+1](x)();
+ BOOST_TEST(x+1 == y);
+ }
+
+ {
+ int x = lambda[val(1)]()();
+ BOOST_TEST(x == 1);
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/phoenix/test/scope/more_let_tests.cpp b/src/boost/libs/phoenix/test/scope/more_let_tests.cpp
new file mode 100644
index 000000000..5950e6ef1
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/more_let_tests.cpp
@@ -0,0 +1,156 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2015 John Fletcher
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+#ifdef __OPTIMIZE__
+ int x = (let(_a = 1)[let(_b = _1)[ _a + 0 ]])(y);
+#else
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+#endif
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = 0)[let(_b = _1)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ //int y = 0;
+#ifdef __OPTIMIZE__
+ int x = (let(_a = 1)[let(_b = _a)[ _a + 0 ]])();
+#else
+ int x = (let(_a = 1)[let(_b = _a)[ _a ]])();
+#endif
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ //int y = 0;
+#ifdef __OPTIMIZE__
+ int x = (let(_a = 1)[let(_b = _a)[ _b + 0 ]])();
+#else
+ int x = (let(_a = 1)[let(_b = _a)[ _b ]])();
+#endif
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ // Be very careful. Some of these cases give a silly answer
+ // with clang 3.4 with C++03 and work for C++11.
+ // gcc 4.8.2 seems O.K. both ways. Oh dear.
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ {
+ int y = 0;
+#ifdef __OPTIMIZE__
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _a + 0 ]])(y);
+#else
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _a ]])(y);
+#endif
+ //std::cout << x << " P1A "; //clang - empty memory
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+#ifdef __OPTIMIZE__
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _b + 0 ]])(y);
+#else
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _b ]])(y);
+#endif
+ //std::cout << x << " P1B "; //clang - 42 value- one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+#ifdef __OPTIMIZE__
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ val(_a) ]])(y);
+#else
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _a ]])(y);
+#endif
+ //std::cout << x << " P2A "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+#ifdef __OPTIMIZE__
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ val(_b) ]])(y);
+#else
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _b ]])(y);
+#endif
+ //std::cout << x << " P2B "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 1;
+ int x = (let(_a = _1, _b = val(2))[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P3 "; //clang - OK - one step better still
+ BOOST_TEST(x == 1);
+ }
+
+ {
+ int y = 0;
+#ifdef __OPTIMIZE__
+ int x = (let(_a = 1, _b = 2)[let(_b = _1)[ _a + 0 ]])(y);
+#else
+ int x = (let(_a = 1, _b = 2)[let(_b = _1)[ _a ]])(y);
+#endif
+ // std::cout << x << " Q "; // clang 4201472
+ BOOST_TEST(x == 1);
+ }
+
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/more_let_tests1.cpp b/src/boost/libs/phoenix/test/scope/more_let_tests1.cpp
new file mode 100644
index 000000000..d4dddf1e4
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/more_let_tests1.cpp
@@ -0,0 +1,136 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2015 John Fletcher
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+#if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 50000) && __OPTIMIZE__
+ int x = (let(_a = _2)[let(_b = _1)[ _a ]])(y,1);
+#else
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+#endif
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = 0)[let(_b = _1)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ //int y = 0;
+#if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 50000) && __OPTIMIZE__
+ int x = (let(_a = 1)[let(_b = _a)[ _a ]])();
+#else
+ int x = (let(_a = _1)[let(_b = _a)[ _a ]])(1);
+#endif
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ //int y = 0;
+#if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 50000) && __OPTIMIZE__
+ int x = (let(_a = _1)[let(_b = _a)[ _b ]])(1);
+#else
+ int x = (let(_a = 1)[let(_b = _a)[ _b ]])();
+#endif
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ // Be very careful. Some of these cases give a silly answer
+ // with clang 3.4 with C++03 and work for C++11.
+ // gcc 4.8.2 seems O.K. both ways. Oh dear.
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ /* {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P1A "; //clang - empty memory
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _b ]])(y);
+ //std::cout << x << " P1B "; //clang - 42 value- one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P2A "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _b ]])(y);
+ //std::cout << x << " P2B "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 1;
+ int x = (let(_a = _1, _b = val(2))[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P3 "; //clang - OK - one step better still
+ BOOST_TEST(x == 1);
+ }
+
+ {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _1)[ _a ]])(y);
+ // std::cout << x << " Q "; // clang 4201472
+ BOOST_TEST(x == 1);
+ }
+ */
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/more_let_tests2.cpp b/src/boost/libs/phoenix/test/scope/more_let_tests2.cpp
new file mode 100644
index 000000000..fb3fff8c1
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/more_let_tests2.cpp
@@ -0,0 +1,125 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+ /*
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = 0)[let(_b = _1)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ //int y = 0;
+ int x = (let(_a = 1)[let(_b = _a)[ _a ]])();
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ //int y = 0;
+ int x = (let(_a = 1)[let(_b = _a)[ _b ]])();
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ */
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ // Be very careful. Some of these cases give a silly answer
+ // with clang 3.4 with C++03 and work for C++11.
+ // gcc 4.8.2 seems O.K. both ways. Oh dear.
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P1A "; //clang - empty memory
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _b ]])(y);
+ //std::cout << x << " P1B "; //clang - 42 value- one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P2A "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _b ]])(y);
+ //std::cout << x << " P2B "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 1;
+ int x = (let(_a = _1, _b = val(2))[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P3 "; //clang - OK - one step better still
+ BOOST_TEST(x == 1);
+ }
+
+ {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _1)[ _a ]])(y);
+ // std::cout << x << " Q "; // clang 4201472
+ BOOST_TEST(x == 1);
+ }
+
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/more_let_tests2a.cpp b/src/boost/libs/phoenix/test/scope/more_let_tests2a.cpp
new file mode 100644
index 000000000..9a4aca716
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/more_let_tests2a.cpp
@@ -0,0 +1,126 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2015 John Fletcher
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+ /*
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = 0)[let(_b = _1)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ //int y = 0;
+ int x = (let(_a = 1)[let(_b = _a)[ _a ]])();
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ //int y = 0;
+ int x = (let(_a = 1)[let(_b = _a)[ _b ]])();
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ */
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ // Be very careful. Some of these cases give a silly answer
+ // with clang 3.4 with C++03 and work for C++11.
+ // gcc 4.8.2 seems O.K. both ways. Oh dear.
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P1A "; //clang - empty memory
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _b ]])(y);
+ //std::cout << x << " P1B "; //clang - 42 value- one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P2A "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+ }
+ /* {
+ int y = 0;
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _b ]])(y);
+ //std::cout << x << " P2B "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 1;
+ int x = (let(_a = _1, _b = val(2))[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P3 "; //clang - OK - one step better still
+ BOOST_TEST(x == 1);
+ }
+
+ {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _1)[ _a ]])(y);
+ // std::cout << x << " Q "; // clang 4201472
+ BOOST_TEST(x == 1);
+ }
+ */
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/more_let_tests2b.cpp b/src/boost/libs/phoenix/test/scope/more_let_tests2b.cpp
new file mode 100644
index 000000000..b6039f8f1
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/more_let_tests2b.cpp
@@ -0,0 +1,136 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2015 John Fletcher
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+#include <vector>
+
+#include <boost/phoenix/core/limits.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
+
+#include <typeinfo>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+int
+main()
+{
+ using boost::phoenix::let;
+ using boost::phoenix::val;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+ using boost::phoenix::local_names::_b;
+ /*
+ {
+ // show that we can return a local from an outer scope
+ int y = 0;
+ int x = (let(_a = 1)[let(_b = _1)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = 0)[let(_b = _1)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ //int y = 0;
+ int x = (let(_a = 1)[let(_b = _a)[ _a ]])();
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ //int y = 0;
+ int x = (let(_a = 1)[let(_b = _a)[ _b ]])();
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an outer scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _a ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ {
+ // show that we can return a local from an inner scope
+ int y = 1;
+ int x = (let(_a = _1)[let(_b = _a)[ _b ]])(y);
+
+ BOOST_TEST(x == 1);
+ }
+ */
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ // Be very careful. Some of these cases give a silly answer
+ // with clang 3.4 with C++03 and work for C++11.
+ // gcc 4.8.2 seems O.K. both ways. Oh dear.
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ /*{
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P1A "; //clang - empty memory
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = 1, _b = 2)[let(_b = _a)[ _b ]])(y);
+ //std::cout << x << " P1B "; //clang - 42 value- one step better
+ BOOST_TEST(x == 1);
+ }
+ {
+ int y = 0;
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P2A "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+ }*/
+ {
+ int y = 0;
+#if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 50000) && __OPTIMIZE__
+ //int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _b ]])(y);
+#else
+ int x = (let(_a = val(1), _b = val(2))[let(_b = _a)[ _b ]])(y);
+ //std::cout << x << " P2B "; //clang - 42 value - one step better
+ BOOST_TEST(x == 1);
+#endif
+ }
+ {
+ int y = 1;
+ int x = (let(_a = _1, _b = val(2))[let(_b = _a)[ _a ]])(y);
+ //std::cout << x << " P3 "; //clang - OK - one step better still
+ BOOST_TEST(x == 1);
+ }
+
+ {
+ int y = 0;
+#if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 50000) && __OPTIMIZE__
+ int z = 2;
+ int x = (let(_a = _1, _b = _2)[let(_b = _1)[ _a ]])(y,z);
+#else
+ int x = (let(_a = 1, _b = 2)[let(_b = _1)[ _a ]])(y);
+#endif
+ // std::cout << x << " Q "; // clang 4201472
+ BOOST_TEST(x == 1);
+ }
+
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/phoenix/test/scope/this.cpp b/src/boost/libs/phoenix/test/scope/this.cpp
new file mode 100644
index 000000000..2f9ae578a
--- /dev/null
+++ b/src/boost/libs/phoenix/test/scope/this.cpp
@@ -0,0 +1,124 @@
+/*=============================================================================
+ Copyright (c) 2011 Thomas Heller
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/statement.hpp>
+#include <boost/phoenix/operator.hpp>
+#include <boost/phoenix/scope.hpp>
+#include <iostream>
+#include <boost/phoenix/scope/this.hpp>
+
+
+template <typename T0>
+void f(T0 t)
+{
+ std::cout << t(1) << "\n";
+ std::cout << t(2) << "\n";
+ std::cout << t(3) << "\n";
+ std::cout << t(4) << "\n";
+ std::cout << t(5) << "\n";
+ std::cout << t(6) << "\n";
+ std::cout << t(7) << "\n";
+}
+
+template <typename T0>
+void f_2(T0 t)
+{
+ for(int i = 0; i < 10; ++i)
+ {
+ for(int j = 0; j < i; ++j)
+ {
+ std::cout << t(i, j) << " ";
+ }
+ std::cout << "\n";
+ }
+}
+
+int main()
+{
+ //using boost::phoenix::_this;
+ using boost::phoenix::if_;
+ using boost::phoenix::if_else;
+ using boost::phoenix::val;
+ using boost::phoenix::let;
+ using boost::phoenix::nothing;
+ using boost::phoenix::arg_names::_1;
+ using boost::phoenix::arg_names::_2;
+ using boost::phoenix::local_names::_a;
+
+ f((
+ if_(_1 == 0)
+ [
+ std::cout << val("\n")
+ ]
+ .else_
+ [
+ std::cout << _1 << " "
+ , this_(_1 - 1)
+ ]
+ , val(0)
+ ));
+
+/*
+ f((
+ if_else(
+ _1 == 0
+ , _1
+ ,this_(_1 - 1)
+ )
+ ));
+*/
+
+ f((
+ if_else(
+ _1 != 0
+ ,this_(_1 - 1)
+ , _1
+ )
+ ));
+/*
+
+ f(( // fac(n) = n * fac(n-1); fac(1) = 1
+ if_else(
+ _1 <= 1
+ , 1
+ , _1 * _this(_1 - 1)
+ )
+ ));
+
+ f(( // fac(n) = n * fac(n-1); fac(1) = 1
+ if_else(
+ _1 > 1
+ , let(_a = _this(_1-1))[_1 * _a]
+ , 1
+ )
+ ));
+
+ f(( // fib(n) = fib(n-1) + fib(n-2); fib(0) = 0; fib(1) = 1
+ if_else(
+ _1 == 0
+ , 0
+ , if_else(
+ _1 == 1
+ , 1
+ , _this(_1 - 1) + _this(_1 - 2)
+ )
+ )
+ ));
+
+ f_2(( // bin(n, k) = bin(n-1, k-1) + bin(n-1, k); bin(n, 0) = 1; bin(0, k) = 0
+ if_else(
+ _1 == 0
+ , 0
+ , if_else(
+ _2 == 0
+ , 1
+ , _this(_1 - 1, _2 - 1) + _this(_1 - 1, _2)
+ )
+ )
+ ));
+*/
+}