mirror of
https://github.com/boostorg/optional.git
synced 2025-07-16 05:42:07 +02:00
Work around msvc bug when explicitly destroying a class with a virtual base. Fixes #5940.
[SVN r82915]
This commit is contained in:
@ -476,7 +476,7 @@ class optional_base : public optional_tag
|
|||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
||||||
void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; }
|
void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; }
|
||||||
#else
|
#else
|
||||||
void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->T::~T() ; m_initialized = false ; }
|
void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->~T() ; m_initialized = false ; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void destroy_impl ( is_reference_tag ) { m_initialized = false ; }
|
void destroy_impl ( is_reference_tag ) { m_initialized = false ; }
|
||||||
|
@ -840,11 +840,19 @@ void test_with_builtin_types()
|
|||||||
test_none( ARG(double) ) ;
|
test_none( ARG(double) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MSVC < 11.0 doesn't destroy X when we call ptr->VBase::VBase.
|
||||||
|
// Make sure that we work around this bug.
|
||||||
|
struct VBase : virtual X
|
||||||
|
{
|
||||||
|
VBase(int v) : X(v) {}
|
||||||
|
};
|
||||||
|
|
||||||
void test_with_class_type()
|
void test_with_class_type()
|
||||||
{
|
{
|
||||||
TRACE( std::endl << BOOST_CURRENT_FUNCTION );
|
TRACE( std::endl << BOOST_CURRENT_FUNCTION );
|
||||||
|
|
||||||
test_basics( ARG(X) );
|
test_basics( ARG(X) );
|
||||||
|
test_basics( ARG(VBase) );
|
||||||
test_conditional_ctor_and_get_valur_or( ARG(X) );
|
test_conditional_ctor_and_get_valur_or( ARG(X) );
|
||||||
test_direct_value_manip( ARG(X) );
|
test_direct_value_manip( ARG(X) );
|
||||||
test_uninitialized_access( ARG(X) );
|
test_uninitialized_access( ARG(X) );
|
||||||
|
Reference in New Issue
Block a user