Merge pull request #28 from mat007/fix-mocking-a-returned-reference

Fix mocking a function returning a reference
This commit is contained in:
Mathieu Champlon 2017-01-15 17:14:51 +01:00 committed by GitHub
commit 238fff3fe2
3 changed files with 8 additions and 2 deletions

View file

@ -7,6 +7,13 @@
[section Changelog] [section Changelog]
[section unreleased]
Not yet released
* Fixed mocking of a function returning a reference for gcc 4.1
[endsect]
[section 1.3.0] [section 1.3.0]
Released 17 July 2016 Released 17 July 2016

View file

@ -150,7 +150,7 @@ namespace detail
return static_cast< value_imp< T >& >( *v_ ).t_; return static_cast< value_imp< T >& >( *v_ ).t_;
} }
template< typename T > template< typename T >
Result& store( T* t ) typename boost::remove_reference< Result >::type& store( T* t )
{ {
v_.reset( new value_imp< Result >( t ) ); v_.reset( new value_imp< Result >( t ) );
return static_cast< value_imp< Result >& >( *v_ ).t_; return static_cast< value_imp< Result >& >( *v_ ).t_;

View file

@ -9,7 +9,6 @@
#include "mock_error.hpp" #include "mock_error.hpp"
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/auto_unit_test.hpp> #include <boost/test/auto_unit_test.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>