$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r62620 - in trunk: boost/lambda/detail libs/lambda/test
From: jewillco_at_[hidden]
Date: 2010-06-08 20:33:25
Author: jewillco
Date: 2010-06-08 20:33:25 EDT (Tue, 08 Jun 2010)
New Revision: 62620
URL: http://svn.boost.org/trac/boost/changeset/62620
Log:
Changed compound assignment (and actually all binary operators) to copy their RHS arguments like the documentation said; added a test for this; fixes #4043
Text files modified: 
   trunk/boost/lambda/detail/operators.hpp          |     6 +++---                                  
   trunk/libs/lambda/test/operator_tests_simple.cpp |    16 ++++++++++++++++                        
   2 files changed, 19 insertions(+), 3 deletions(-)
Modified: trunk/boost/lambda/detail/operators.hpp
==============================================================================
--- trunk/boost/lambda/detail/operators.hpp	(original)
+++ trunk/boost/lambda/detail/operators.hpp	2010-06-08 20:33:25 EDT (Tue, 08 Jun 2010)
@@ -37,16 +37,16 @@
 lambda_functor<                                                              \
   lambda_functor_base<                                                       \
     ACTION,                                                                  \
-    tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type>         \
+    tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>  \
   >                                                                          \
 >                                                                            \
 OPER_NAME (const lambda_functor<Arg>& a, CONSTB& b) {                      \
   return                                                                     \
     lambda_functor_base<                                                     \
       ACTION,                                                                \
-      tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type>       \
+      tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>\
     >                                                                        \
-   (tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type>(a, b)); \
+   (tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>(a, b)); \
 }
 
 
Modified: trunk/libs/lambda/test/operator_tests_simple.cpp
==============================================================================
--- trunk/libs/lambda/test/operator_tests_simple.cpp	(original)
+++ trunk/libs/lambda/test/operator_tests_simple.cpp	2010-06-08 20:33:25 EDT (Tue, 08 Jun 2010)
@@ -235,6 +235,22 @@
   (_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);