Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75549 - trunk/libs/scope_exit/test
From: Alexander.Nasonov_at_[hidden]
Date: 2011-11-19 06:53:59


Author: nasonov
Date: 2011-11-19 06:53:58 EST (Sat, 19 Nov 2011)
New Revision: 75549
URL: http://svn.boost.org/trac/boost/changeset/75549

Log:
Test modification of a variable passed to a block by value.
Text files modified:
   trunk/libs/scope_exit/test/native.cpp | 8 +++++++-
   1 files changed, 7 insertions(+), 1 deletions(-)

Modified: trunk/libs/scope_exit/test/native.cpp
==============================================================================
--- trunk/libs/scope_exit/test/native.cpp (original)
+++ trunk/libs/scope_exit/test/native.cpp 2011-11-19 06:53:58 EST (Sat, 19 Nov 2011)
@@ -121,6 +121,11 @@
     return true;
 }
 
+bool foo2()
+{
+ return false;
+}
+
 void test_types()
 {
     bool (*pf)() = 0;
@@ -149,6 +154,7 @@
         {
             results[0] = !pf();
             results[1] = !pf();
+ pf = &foo2; // modify a copy
         }
         BOOST_SCOPE_EXIT_END
 
@@ -158,6 +164,7 @@
         BOOST_CHECK(results[1] == true);
     }
 
+ BOOST_CHECK(pf == 0);
     BOOST_CHECK(results[0] == false);
     BOOST_CHECK(results[1] == false);
 }
@@ -169,4 +176,3 @@
     framework::master_test_suite().add( BOOST_TEST_CASE( &test_types ));
     return 0;
 }
-


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk