diff --git a/include/boost/optional/detail/union_optional.hpp b/include/boost/optional/detail/union_optional.hpp index 4993f58..ce14e3a 100644 --- a/include/boost/optional/detail/union_optional.hpp +++ b/include/boost/optional/detail/union_optional.hpp @@ -349,7 +349,9 @@ namespace boost { } template )> + BOOST_OPTIONAL_REQUIRES(::std::is_constructible), + BOOST_OPTIONAL_REQUIRES(!optional_detail::is_typed_in_place_factory), + BOOST_OPTIONAL_REQUIRES(!optional_detail::is_in_place_factory)> constexpr explicit optional(U&& v) : storage(optional_ns::in_place_init, optional_detail::forward_(v)) {} @@ -463,7 +465,9 @@ namespace boost { BOOST_OPTIONAL_REQUIRES(!::std::is_same::type, optional>), BOOST_OPTIONAL_REQUIRES(!optional_detail::conjunction<::std::is_scalar, ::std::is_same>), BOOST_OPTIONAL_REQUIRES(::std::is_constructible), - BOOST_OPTIONAL_REQUIRES(::std::is_assignable) + BOOST_OPTIONAL_REQUIRES(::std::is_assignable), + BOOST_OPTIONAL_REQUIRES(!optional_detail::is_typed_in_place_factory), + BOOST_OPTIONAL_REQUIRES(!optional_detail::is_in_place_factory) > BOOST_OPTIONAL_CXX20_CONSTEXPR optional& operator=(U&& v) { diff --git a/test/optional_test_inplace_factory.cpp b/test/optional_test_inplace_factory.cpp index 9960c62..31a89ed 100644 --- a/test/optional_test_inplace_factory.cpp +++ b/test/optional_test_inplace_factory.cpp @@ -105,9 +105,42 @@ void test_assign() #endif } +// begin Boost.Log case + +template +struct basic_formatter +{ + template< typename FunT > + basic_formatter(FunT&& fun) {} + + template< typename FunT > + basic_formatter& operator= (FunT&& fun) + { + return *this; + } +}; + +template< typename CharT> +struct chained_formatter +{ +}; + +void test_boost_log_case() +{ +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + + boost::optional> of( boost::in_place(chained_formatter()) ); + of = boost::in_place(chained_formatter()); + +#endif //BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT +} + +// end Boost.Log case + int main() { test_ctor(); test_assign(); + test_boost_log_case(); return boost::report_errors(); } diff --git a/test/optional_test_msvc_bug_workaround.cpp b/test/optional_test_msvc_bug_workaround.cpp index 8d37068..04448c0 100644 --- a/test/optional_test_msvc_bug_workaround.cpp +++ b/test/optional_test_msvc_bug_workaround.cpp @@ -32,6 +32,7 @@ void test() //BOOST_TEST(v); boost::optional> vv; bool xx = vv?true : false; + (void)xx; BOOST_TEST_EQ(*v, 7); #endif }