From a13ccee145f6a29cff2dc8f4bc2d14a1343835ca Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 18 Oct 2018 17:46:32 +0300 Subject: [PATCH] Fix tests when X3 is not v2d::trivially_move_assignable --- test/variant_valueless.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/test/variant_valueless.cpp b/test/variant_valueless.cpp index 34b90af..6a13086 100644 --- a/test/variant_valueless.cpp +++ b/test/variant_valueless.cpp @@ -230,8 +230,18 @@ int main() } catch( std::exception const& ) { - // all trivially destructible and move-assignable, no change - BOOST_TEST_EQ( v.index(), 0 ); + // X3 is not v2d::trivially_move_assignable on libstdc++ 4.x + + if( v2d::is_trivially_move_assignable::value ) + { + // all trivially destructible and move-assignable, no change + BOOST_TEST_EQ( v.index(), 0 ); + } + else + { + // basic guarantee; X1 is nothrow default-constructible + BOOST_TEST_EQ( v.index(), 1 ); + } } } @@ -247,8 +257,18 @@ int main() } catch( std::exception const& ) { - // all trivially destructible and move-assignable, no change - BOOST_TEST_EQ( v.index(), 0 ); + // X3 is not v2d::trivially_move_assignable on libstdc++ 4.x + + if( v2d::is_trivially_move_assignable::value ) + { + // all trivially destructible and move-assignable, no change + BOOST_TEST_EQ( v.index(), 0 ); + } + else + { + // basic guarantee; monostate + BOOST_TEST_EQ( v.index(), 2 ); + } } }