diff --git a/include/boost/lambda/detail/operators.hpp b/include/boost/lambda/detail/operators.hpp index 29eb106..149e1ee 100644 --- a/include/boost/lambda/detail/operators.hpp +++ b/include/boost/lambda/detail/operators.hpp @@ -37,16 +37,16 @@ inline const \ lambda_functor< \ lambda_functor_base< \ ACTION, \ - tuple, typename CONVERSION ::type> \ + tuple, typename const_copy_argument ::type> \ > \ > \ OPER_NAME (const lambda_functor& a, CONSTB& b) { \ return \ lambda_functor_base< \ ACTION, \ - tuple, typename CONVERSION ::type> \ + tuple, typename const_copy_argument ::type>\ > \ - (tuple, typename CONVERSION ::type>(a, b)); \ + (tuple, typename const_copy_argument ::type>(a, b)); \ } diff --git a/test/operator_tests_simple.cpp b/test/operator_tests_simple.cpp index aa3069d..34711fb 100644 --- a/test/operator_tests_simple.cpp +++ b/test/operator_tests_simple.cpp @@ -235,6 +235,22 @@ void compound_operators() { (_1 %= 2)(i); BOOST_CHECK(i == 1); + // lambda expression as a left operand with rvalue on RHS + (_1 += (0 + 1))(i); + BOOST_CHECK(i == 2); + + (_1 -= (0 + 1))(i); + BOOST_CHECK(i == 1); + + (_1 *= (0 + 10))(i); + BOOST_CHECK(i == 10); + + (_1 /= (0 + 2))(i); + BOOST_CHECK(i == 5); + + (_1 %= (0 + 2))(i); + BOOST_CHECK(i == 1); + // shifts unsigned int ui = 2; (_1 <<= 1)(ui);