Added test to ensure proper binding of optional references (in reference to Ticket 1301)

[SVN r40707]
This commit is contained in:
Fernando Cacciola
2007-11-02 23:41:37 +00:00
parent 06ba35cd42
commit 3b5b5d82a0

View File

@ -337,12 +337,30 @@ void test_with_class_type()
BOOST_CHECK ( X::count == 0 ) ;
}
void test_binding()
{
int i = 0 ;
optional<int&> ori1 = i ;
BOOST_CHECK( &(*ori1) == &i ) ;
optional<int&> ori2(i) ;
BOOST_CHECK( &(*ori2) == &i ) ;
int const ci = 0 ;
optional<int const&> orci1 = ci ;
BOOST_CHECK( &(*orci1) == &ci ) ;
optional<int const&> orci2 = ci ;
BOOST_CHECK( &(*orci2) == &ci ) ;
}
int test_main( int, char* [] )
{
try
{
test_with_class_type();
test_with_builtin_types();
test_binding();
}
catch ( ... )
{