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

This commit is contained in:
Peter Dimov
2024-04-08 18:01:41 +03:00
parent 75ab18c9fd
commit 96fef94580
2 changed files with 63 additions and 1 deletions
+44
View File
@@ -59,6 +59,10 @@ void fv1( int /*x*/ )
{
}
void fv2()
{
}
int main()
{
{
@@ -243,5 +247,45 @@ int main()
BOOST_TEST( r2.has_error() );
}
{
result<void> r;
result<void> r2 = r & fv2;
BOOST_TEST( r2.has_value() );
}
{
result<void> const r;
result<void> r2 = r & fv2;
BOOST_TEST( r2.has_value() );
}
{
result<void> r2 = result<void>() & fv2;
BOOST_TEST( r2.has_value() );
}
{
result<void, E> r( in_place_error );
result<void, E> r2 = r & fv2;
BOOST_TEST( r2.has_error() );
}
{
result<void, E> const r( in_place_error );
result<void, E> r2 = r & fv2;
BOOST_TEST( r2.has_error() );
}
{
result<void, E> r2 = result<void, E>( in_place_error ) & fv2;
BOOST_TEST( r2.has_error() );
}
return boost::report_errors();
}