Apply msvc-14.0 workarounds

This commit is contained in:
Peter Dimov
2020-01-22 17:38:45 +02:00
parent c4cad3e96a
commit 17bc06b090
2 changed files with 53 additions and 9 deletions

View File

@ -1257,9 +1257,27 @@ public:
{
}
#if !BOOST_WORKAROUND( BOOST_MSVC, < 1910 )
variant( variant const& ) = default;
variant( variant && ) = default;
#else
private:
variant( variant const volatile& ) = delete;
public:
template<class E = std::enable_if< std::is_copy_constructible<variant_base>::value >::type>
constexpr variant( variant const& r ) noexcept( std::is_nothrow_copy_constructible<variant_base>::value ): variant_base( static_cast<variant_base const&>( r ) ) {}
template<class E = std::enable_if< std::is_move_constructible<variant_base>::value >::type>
constexpr variant( variant && r ) noexcept( std::is_nothrow_move_constructible<variant_base>::value ): variant_base( static_cast<variant_base &&>( r ) ) {}
#endif
template<class U,
class Ud = typename std::decay<U>::type,
class E1 = typename std::enable_if< !std::is_same<Ud, variant>::value && !detail::is_in_place_index<Ud>::value && !detail::is_in_place_type<Ud>::value >::type,
@ -1294,9 +1312,35 @@ public:
// assignment
#if !BOOST_WORKAROUND( BOOST_MSVC, < 1910 )
variant& operator=( variant const& ) = default;
variant& operator=( variant && ) = default;
#else
private:
variant& operator=( variant const volatile& ) = delete;
public:
template<class E = std::enable_if< std::is_copy_assignable<variant_base>::value >::type>
variant& operator=( variant const& r ) noexcept( std::is_nothrow_copy_assignable<variant_base>::value )
{
static_cast< variant_base& >( *this ) = static_cast< variant_base const& >( r );
return *this;
}
template<class E = std::enable_if< std::is_move_assignable<variant_base>::value >::type>
variant& operator=( variant && r ) noexcept( std::is_nothrow_move_assignable<variant_base>::value )
{
static_cast< variant_base& >( *this ) = static_cast< variant_base && >( r );
return *this;
}
#endif
template<class U,
class E1 = typename std::enable_if<!std::is_same<typename std::decay<U>::type, variant>::value>::type,
class V = detail::resolve_overload_type<U, T...>,

View File

@ -29,16 +29,16 @@ run variant_size.cpp ;
run variant_alternative.cpp ;
run variant_holds_alternative.cpp ;
compile variant_holds_alternative_cx.cpp ;
compile variant_holds_alternative_cx.cpp : <toolset>msvc-14.0:<build>no ;
run variant_get_by_index.cpp ;
compile variant_get_by_index_cx.cpp ;
compile variant_get_by_index_cx.cpp : <toolset>msvc-14.0:<build>no ;
run variant_get_by_type.cpp ;
compile variant_get_by_type_cx.cpp ;
compile variant_get_by_type_cx.cpp : <toolset>msvc-14.0:<build>no ;
run variant_default_construct.cpp ;
compile variant_default_construct_cx.cpp ;
compile variant_default_construct_cx.cpp : <toolset>msvc-14.0:<build>no ;
run variant_copy_construct.cpp ;
compile variant_copy_construct_cx.cpp : <toolset>msvc-14.0:<build>no ;
@ -47,13 +47,13 @@ run variant_move_construct.cpp ;
compile variant_move_construct_cx.cpp : [ requires cxx14_constexpr ] ;
run variant_value_construct.cpp ;
compile variant_value_construct_cx.cpp ;
compile variant_value_construct_cx.cpp : <toolset>msvc-14.0:<build>no ;
run variant_in_place_index_construct.cpp ;
compile variant_in_place_index_construct_cx.cpp ;
compile variant_in_place_index_construct_cx.cpp : <toolset>msvc-14.0:<build>no ;
run variant_in_place_type_construct.cpp ;
compile variant_in_place_type_construct_cx.cpp ;
compile variant_in_place_type_construct_cx.cpp : <toolset>msvc-14.0:<build>no ;
run variant_copy_assign.cpp ;
compile variant_copy_assign_cx.cpp : [ requires cxx14_constexpr ] ;
@ -99,10 +99,10 @@ local NX =
;
run variant_get_by_index.cpp throw_exception.cpp : : : $(NX) : variant_get_by_index_nx ;
compile variant_get_by_index_cx.cpp : $(NX) : variant_get_by_index_cx_nx ;
compile variant_get_by_index_cx.cpp : $(NX) <toolset>msvc-14.0:<build>no : variant_get_by_index_cx_nx ;
run variant_get_by_type.cpp throw_exception.cpp : : : $(NX) : variant_get_by_type_nx ;
compile variant_get_by_type_cx.cpp : $(NX) : variant_get_by_type_cx_nx ;
compile variant_get_by_type_cx.cpp : $(NX) <toolset>msvc-14.0:<build>no : variant_get_by_type_cx_nx ;
run variant_subset.cpp throw_exception.cpp : : : $(NX) : variant_subset_nx ;