Support result<X> & fv, where fv returns void. Refs #119.

This commit is contained in:
Peter Dimov committed 2024-04-08 17:55:50 +03:00
1 parent f9a4655ae7
commit 75ab18c9fd
2 files changed
+82 -2

No files matched your search

+44
View File
@@ -55,6 +55,10 @@ int k()
return 7;
}
void fv1( int /*x*/ )
{
}
int main()
{
{
@@ -199,5 +203,45 @@ int main()
BOOST_TEST( r2.has_error() );
}
{
result<int> r( 1 );
result<void> r2 = r & fv1;
BOOST_TEST( r2.has_value() );
}
{
result<int> const r( 1 );
result<void> r2 = r & fv1;
BOOST_TEST( r2.has_value() );
}
{
result<void> r2 = result<int>( 1 ) & fv1;
BOOST_TEST( r2.has_value() );
}
{
result<int, E> r( in_place_error );
result<void, E> r2 = r & fv1;
BOOST_TEST( r2.has_error() );
}
{
result<int, E> const r( in_place_error );
result<void, E> r2 = r & fv1;
BOOST_TEST( r2.has_error() );
}
{
result<void, E> r2 = result<int, E>( in_place_error ) & fv1;
BOOST_TEST( r2.has_error() );
}
return boost::report_errors();
}