mirror of
https://github.com/boostorg/optional.git
synced 2025-07-30 20:47:18 +02:00
GCC 4.4.7: boost::in_place & Assignment
Assigning a boost::in_place_factory to a boost::optional templated on a type which was trivially copyable failed to compile under GCC 4.4.7.
This commit is contained in:
@ -359,7 +359,7 @@ class tc_optional_base : public optional_tag
|
||||
template<class Expr>
|
||||
void construct ( Expr const& factory, in_place_factory_base const* )
|
||||
{
|
||||
boost_optional_detail::construct<value_type>(factory, m_storage.address());
|
||||
boost_optional_detail::construct<value_type>(factory, boost::addressof(m_storage));
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,9 @@ void test_ctor()
|
||||
BOOST_TEST(og1_ == og1);
|
||||
BOOST_TEST(og1_ != og2);
|
||||
BOOST_TEST(og1_ != og0);
|
||||
|
||||
boost::optional<unsigned int> 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<unsigned int> o;
|
||||
o = boost::in_place(5);
|
||||
BOOST_TEST(o && (*o == 5));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user