1 /*============================================================================= 2 Copyright (c) 2018 Nikita Kniazev 3 4 Distributed under the Boost Software License, Version 1.0. (See accompanying 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 ==============================================================================*/ 7 8 #include <boost/detail/lightweight_test.hpp> 9 #include <boost/phoenix.hpp> 10 #include <boost/function.hpp> 11 #include <string> 12 13 // Checks that rhs Phoenix actor is taken by value on assignment. 14 // The wrapper function is used to ensure that created temporaries are 15 // out of scope (as they will be created on the other stack frame). 16 make_assignment_test(std::string & s)17boost::function<void()> make_assignment_test(std::string & s) 18 { 19 return boost::phoenix::ref(s) = "asd"; 20 } 21 main()22int main() 23 { 24 std::string s; 25 make_assignment_test(s)(); 26 BOOST_TEST(s == "asd"); 27 28 return boost::report_errors(); 29 } 30