diff options
Diffstat (limited to 'libs/phoenix/test/scope/more_let_tests.cpp')
-rw-r--r-- | libs/phoenix/test/scope/more_let_tests.cpp | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/libs/phoenix/test/scope/more_let_tests.cpp b/libs/phoenix/test/scope/more_let_tests.cpp index cfc5b11ec..5950e6ef1 100644 --- a/libs/phoenix/test/scope/more_let_tests.cpp +++ b/libs/phoenix/test/scope/more_let_tests.cpp @@ -1,7 +1,8 @@ /*============================================================================= Copyright (c) 2001-2007 Joel de Guzman + Copyright (c) 2015 John Fletcher - Distributed under the Boost Software License, Version 1.0. (See accompanying + 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> @@ -31,22 +32,17 @@ main() 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; { // 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); } { @@ -59,15 +55,21 @@ main() { // 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); } { @@ -92,24 +94,41 @@ main() //++++++++++++++++++++++++++++++++++++++++++++++++++++++++ { 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); } @@ -122,7 +141,11 @@ main() { 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); } |