Merge branch 'develop'

This commit is contained in:
jzmaddock
2015-05-21 18:51:23 +01:00
4 changed files with 61 additions and 0 deletions

View File

@@ -36,6 +36,17 @@ struct is_virtual_base_of_impl
template<typename Base, typename Derived>
struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
{
union max_align
{
unsigned u;
unsigned long ul;
void* v;
double d;
long double ld;
#ifndef BOOST_NO_LONG_LONG
long long ll;
#endif
};
#ifdef __BORLANDC__
struct boost_type_traits_internal_struct_X : public virtual Derived, public virtual Base
{
@@ -43,6 +54,7 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
boost_type_traits_internal_struct_X(const boost_type_traits_internal_struct_X&);
boost_type_traits_internal_struct_X& operator=(const boost_type_traits_internal_struct_X&);
~boost_type_traits_internal_struct_X()throw();
max_align data[4];
};
struct boost_type_traits_internal_struct_Y : public virtual Derived
{
@@ -50,6 +62,7 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
boost_type_traits_internal_struct_Y(const boost_type_traits_internal_struct_Y&);
boost_type_traits_internal_struct_Y& operator=(const boost_type_traits_internal_struct_Y&);
~boost_type_traits_internal_struct_Y()throw();
max_align data[4];
};
#else
struct boost_type_traits_internal_struct_X : public Derived, virtual Base
@@ -58,6 +71,7 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
boost_type_traits_internal_struct_X(const boost_type_traits_internal_struct_X&);
boost_type_traits_internal_struct_X& operator=(const boost_type_traits_internal_struct_X&);
~boost_type_traits_internal_struct_X()throw();
max_align data[16];
};
struct boost_type_traits_internal_struct_Y : public Derived
{
@@ -65,6 +79,7 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
boost_type_traits_internal_struct_Y(const boost_type_traits_internal_struct_Y&);
boost_type_traits_internal_struct_Y& operator=(const boost_type_traits_internal_struct_Y&);
~boost_type_traits_internal_struct_Y()throw();
max_align data[16];
};
#endif
BOOST_STATIC_CONSTANT(bool, value = (sizeof(boost_type_traits_internal_struct_X)==sizeof(boost_type_traits_internal_struct_Y)));

View File

@@ -12,6 +12,21 @@
# include <boost/type_traits/has_nothrow_constructor.hpp>
#endif
class bug11324_base
{
public:
bug11324_base & operator=(const bug11324_base&){ throw int(); }
virtual ~bug11324_base() {}
};
class bug11324_derived : public bug11324_base
{
public:
char data;
explicit bug11324_derived(char arg) : data(arg) {}
};
TT_TEST_BEGIN(has_nothrow_constructor)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<bool>::value, true);
@@ -162,6 +177,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<nothrow_assign_UDT>:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<nothrow_copy_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<test_abc1>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<bug11324_derived>::value, false);
TT_TEST_END

View File

@@ -12,6 +12,22 @@
# include <boost/type_traits/has_trivial_constructor.hpp>
#endif
class bug11324_base
{
public:
bug11324_base & operator=(const bug11324_base&){ throw int(); }
virtual ~bug11324_base() {}
};
class bug11324_derived : public bug11324_base
{
public:
char data;
explicit bug11324_derived(char arg) : data(arg) {}
};
TT_TEST_BEGIN(has_trivial_constructor)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<bool>::value, true);
@@ -169,6 +185,7 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<wrap<trivial_ex
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<test_abc1>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<bug11324_derived>::value, false);
TT_TEST_END

View File

@@ -38,6 +38,13 @@ public:
virtual int X();
};
//
// These are from https://svn.boost.org/trac/boost/ticket/11309
//
struct bug11309_A { int a; };
struct bug11309_B : public virtual bug11309_A {};
struct bug11309_C : public bug11309_A { virtual ~bug11309_C() {} };
TT_TEST_BEGIN(is_virtual_base_of)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<Derived,Base>::value), false);
@@ -75,6 +82,12 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<Base,virtual_inherit6>::
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<virtual_inherit6,Base>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<B,D>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<non_virtual_base,non_virtual_derived>::value), false);
//
// Bug cases:
//
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<bug11309_A, bug11309_C>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<bug11309_A, bug11309_B>::value), true);
TT_TEST_END