Fix emplace for types with a deleted move constructor (in the trivially destructible case)

This commit is contained in:
Peter Dimov
2019-04-09 18:28:18 +03:00
parent 2e8ae0c796
commit 9f7e525984
2 changed files with 38 additions and 26 deletions

View File

@@ -57,6 +57,16 @@ STATIC_ASSERT( !std::is_nothrow_move_constructible<X2>::value );
STATIC_ASSERT( !std::is_nothrow_copy_assignable<X2>::value );
STATIC_ASSERT( !std::is_nothrow_move_assignable<X2>::value );
struct Y1
{
};
struct Guard
{
explicit Guard(int) {}
Guard(Guard&&) = delete;
};
int main()
{
{
@@ -165,5 +175,10 @@ int main()
BOOST_TEST_EQ( get<0>(v).v, 4 );
}
{
variant<Y1, Guard> v;
v.emplace<Guard>( 1 );
}
return boost::report_errors();
}