From 6558254c507c5df1f62eaaa28e07c6361e7337dc Mon Sep 17 00:00:00 2001 From: mat007 Date: Sun, 23 Nov 2014 10:54:14 +0000 Subject: [PATCH] Fixed boost::cref invalid for temporary objects git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@759 860be788-9bd5-4423-9f1e-828f051e677b --- test/test_log.cpp | 3 ++- test/test_matcher.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test_log.cpp b/test/test_log.cpp index 9b6f6df..0502991 100644 --- a/test/test_log.cpp +++ b/test/test_log.cpp @@ -523,7 +523,8 @@ BOOST_AUTO_TEST_CASE( boost_assign_map_list_of_are_serialized ) BOOST_AUTO_TEST_CASE( boost_reference_wrappers_are_serialized ) { - BOOST_CHECK_EQUAL( "3", to_string( boost::cref( 3 ) ) ); + const int i = 3; + BOOST_CHECK_EQUAL( "3", to_string( boost::cref( i ) ) ); BOOST_CHECK_EQUAL( "\"string\"", to_string( boost::cref( "string" ) ) ); } diff --git a/test/test_matcher.cpp b/test/test_matcher.cpp index 607e60b..c17a0e0 100644 --- a/test/test_matcher.cpp +++ b/test/test_matcher.cpp @@ -27,8 +27,9 @@ BOOST_AUTO_TEST_CASE( int_and_int_can_be_compared ) BOOST_AUTO_TEST_CASE( ref_to_int_and_int_can_be_compared ) { - BOOST_CHECK( match( 3, boost::cref( 3 ) ) ); - BOOST_CHECK( ! match( 4, boost::cref( 3 ) ) ); + const int i = 3; + BOOST_CHECK( match( 3, boost::cref( i ) ) ); + BOOST_CHECK( ! match( 4, boost::cref( i ) ) ); } namespace