fix bug with defaulted move in msvc 12.0

This commit is contained in:
Andrzej Krzemienski
2017-10-31 01:26:18 +01:00
parent ebef3ed6f7
commit 58f7c2f14a
10 changed files with 58 additions and 14 deletions

View File

@ -113,4 +113,15 @@
# define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS
#endif
// Detection of correctly implemented defaulted functions
#ifdef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
# define BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_FUNCTIONS
#elif BOOST_WORKAROUND(BOOST_MSVC, < 1900)
// on MSVC 12.0 move constructor and move assignment are not reconized as special functions
// and they cannot be defaulted
# define BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_FUNCTIONS
#endif
#endif // header guard

View File

@ -496,4 +496,4 @@ class tc_optional_base : public optional_tag
bool m_initialized ;
T m_storage ;
} ;
} ;

View File

@ -954,7 +954,7 @@ class optional
// Creates a deep copy of another optional<T>
// Can throw if T::T(T const&) does
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_FUNCTIONS
optional ( optional const& ) = default;
#else
optional ( optional const& rhs ) : base( static_cast<base const&>(rhs) ) {}
@ -964,7 +964,7 @@ class optional
// Creates a deep move of another optional<T>
// Can throw if T::T(T&&) does
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_FUNCTIONS
optional ( optional && rhs ) = default;
#else
optional ( optional && rhs )
@ -1029,7 +1029,7 @@ class optional
// Assigns from another optional<T> (deep-copies the rhs value)
// Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED
// (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw)
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_FUNCTIONS
optional& operator= ( optional const& rhs ) = default;
#else
optional& operator= ( optional const& rhs )
@ -1041,7 +1041,7 @@ class optional
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Assigns from another optional<T> (deep-moves the rhs value)
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_FUNCTIONS
optional& operator= ( optional && ) = default;
#else
optional& operator= ( optional && rhs )