mirror of
https://github.com/boostorg/variant2.git
synced 2025-08-02 13:44:27 +02:00
Fix tests when X3 is not v2d::trivially_move_assignable
This commit is contained in:
@@ -229,10 +229,20 @@ int main()
|
|||||||
BOOST_ERROR( "`v = e1x;` failed to throw" );
|
BOOST_ERROR( "`v = e1x;` failed to throw" );
|
||||||
}
|
}
|
||||||
catch( std::exception const& )
|
catch( std::exception const& )
|
||||||
|
{
|
||||||
|
// X3 is not v2d::trivially_move_assignable on libstdc++ 4.x
|
||||||
|
|
||||||
|
if( v2d::is_trivially_move_assignable<X3>::value )
|
||||||
{
|
{
|
||||||
// all trivially destructible and move-assignable, no change
|
// all trivially destructible and move-assignable, no change
|
||||||
BOOST_TEST_EQ( v.index(), 0 );
|
BOOST_TEST_EQ( v.index(), 0 );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// basic guarantee; X1 is nothrow default-constructible
|
||||||
|
BOOST_TEST_EQ( v.index(), 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -246,10 +256,20 @@ int main()
|
|||||||
BOOST_ERROR( "`v = e1x;` failed to throw" );
|
BOOST_ERROR( "`v = e1x;` failed to throw" );
|
||||||
}
|
}
|
||||||
catch( std::exception const& )
|
catch( std::exception const& )
|
||||||
|
{
|
||||||
|
// X3 is not v2d::trivially_move_assignable on libstdc++ 4.x
|
||||||
|
|
||||||
|
if( v2d::is_trivially_move_assignable<X3>::value )
|
||||||
{
|
{
|
||||||
// all trivially destructible and move-assignable, no change
|
// all trivially destructible and move-assignable, no change
|
||||||
BOOST_TEST_EQ( v.index(), 0 );
|
BOOST_TEST_EQ( v.index(), 0 );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// basic guarantee; monostate
|
||||||
|
BOOST_TEST_EQ( v.index(), 2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
|
Reference in New Issue
Block a user