diff --git a/include/boost/optional/detail/optional_trivially_copyable_base.hpp b/include/boost/optional/detail/optional_trivially_copyable_base.hpp index 5a37eac..2cabf9a 100644 --- a/include/boost/optional/detail/optional_trivially_copyable_base.hpp +++ b/include/boost/optional/detail/optional_trivially_copyable_base.hpp @@ -359,7 +359,7 @@ class tc_optional_base : public optional_tag template void construct ( Expr const& factory, in_place_factory_base const* ) { - boost_optional_detail::construct(factory, m_storage.address()); + boost_optional_detail::construct(factory, boost::addressof(m_storage)); m_initialized = true ; } diff --git a/test/optional_test_inplace_factory.cpp b/test/optional_test_inplace_factory.cpp index 1e852f0..b8c3130 100644 --- a/test/optional_test_inplace_factory.cpp +++ b/test/optional_test_inplace_factory.cpp @@ -63,6 +63,9 @@ void test_ctor() BOOST_TEST(og1_ == og1); BOOST_TEST(og1_ != og2); BOOST_TEST(og1_ != og0); + + boost::optional o( boost::in_place(5) ); + BOOST_TEST(o && (*o == 5)); #endif } @@ -92,6 +95,10 @@ void test_assign() BOOST_TEST(og1_ == og1); BOOST_TEST(og1_ != og2); BOOST_TEST(og1_ != og0); + + boost::optional o; + o = boost::in_place(5); + BOOST_TEST(o && (*o == 5)); #endif #endif }