Wrapped constraints parameters with boost::addressof where needed in order to support types with overloaded operator&

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@385 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2011-10-02 14:57:25 +00:00
parent 7fc80c1035
commit db36244dfc
2 changed files with 60 additions and 41 deletions

View file

@ -312,3 +312,21 @@ BOOST_AUTO_TEST_CASE( contain_with_strings )
BOOST_CHECK( ! c.f_( std::string( "this is a string" ) ) );
}
}
namespace
{
struct type_with_overloaded_address_operator
{
void operator&() {}
void operator&() const {}
};
}
BOOST_AUTO_TEST_CASE( type_with_overloaded_address_operator_can_be_used_in_constraints )
{
type_with_overloaded_address_operator t;
mock::same( t ).f_( t );
mock::retrieve( t ).f_( t );
type_with_overloaded_address_operator* pt;
mock::retrieve( pt ).f_( t );
}