forked from boostorg/type_traits
Merge branch 'develop' into Version2
This commit is contained in:
@ -266,6 +266,34 @@
|
||||
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
|
||||
#endif
|
||||
|
||||
#if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/is_volatile.hpp>
|
||||
|
||||
# define BOOST_IS_UNION(T) __oracle_is_union(T)
|
||||
# define BOOST_IS_POD(T) __oracle_is_pod(T)
|
||||
# define BOOST_IS_EMPTY(T) __oracle_is_empty(T)
|
||||
# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__oracle_has_trivial_constructor(T) && ! ::boost::is_volatile<T>::value)
|
||||
# define BOOST_HAS_TRIVIAL_COPY(T) (__oracle_has_trivial_copy(T) && !is_reference<T>::value && ! ::boost::is_volatile<T>::value)
|
||||
# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile<T>::value && ! ::boost::is_const<T>::value)
|
||||
# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __oracle_has_trivial_destructor(T)
|
||||
# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__oracle_has_nothrow_constructor(T) || __oracle_has_trivial_constructor(T) || __oracle_is_trivial(T))
|
||||
# define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile<T>::value && !is_reference<T>::value)
|
||||
# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile<T>::value && !is_const<T>::value)
|
||||
# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __oracle_has_virtual_destructor(T)
|
||||
|
||||
# define BOOST_IS_ABSTRACT(T) __oracle_is_abstract(T)
|
||||
//# define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value)
|
||||
# define BOOST_IS_CLASS(T) __oracle_is_class(T)
|
||||
# define BOOST_IS_ENUM(T) __oracle_is_enum(T)
|
||||
# define BOOST_IS_POLYMORPHIC(T) __oracle_is_polymorphic(T)
|
||||
# define BOOST_ALIGNMENT_OF(T) __alignof__(T)
|
||||
# define BOOST_IS_FINAL(T) __oracle_is_final(T)
|
||||
|
||||
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
|
||||
#endif
|
||||
|
||||
#if defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600)
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
|
@ -31,6 +31,17 @@ struct is_virtual_base_of_impl
|
||||
template<typename Base, typename Derived>
|
||||
struct is_virtual_base_of_impl<Base, Derived, true_type>
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -38,6 +49,7 @@ struct is_virtual_base_of_impl<Base, Derived, true_type>
|
||||
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
|
||||
{
|
||||
@ -45,6 +57,7 @@ struct is_virtual_base_of_impl<Base, Derived, true_type>
|
||||
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
|
||||
@ -53,6 +66,7 @@ struct is_virtual_base_of_impl<Base, Derived, true_type>
|
||||
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
|
||||
{
|
||||
@ -60,6 +74,7 @@ struct is_virtual_base_of_impl<Base, Derived, true_type>
|
||||
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)));
|
||||
|
@ -84,7 +84,7 @@ struct type_with_alignment
|
||||
typedef typename boost::detail::char_alignment<Align, boost::alignment_of<char>::value >= Align>::type type;
|
||||
};
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_TT_DISABLE_INTRINSICS)
|
||||
#if (defined(__GNUC__) || (defined (__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130))) && !defined(BOOST_TT_DISABLE_INTRINSICS)
|
||||
namespace tt_align_ns {
|
||||
struct __attribute__((__aligned__(2))) a2 {};
|
||||
struct __attribute__((__aligned__(4))) a4 {};
|
||||
|
@ -22,7 +22,7 @@ struct has {
|
||||
};
|
||||
|
||||
// MSVC can not generate neither default constructor, nor assignment operator,
|
||||
// nor copy constructor for `has2` type. Supressing those warnings is essential,
|
||||
// nor copy constructor for `has2` type. Suppressing those warnings is essential,
|
||||
// because we treat warnings as errors in those tests
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( push )
|
||||
|
@ -20,7 +20,7 @@ struct has {
|
||||
};
|
||||
|
||||
// MSVC can not generate neither default constructor, nor assignment operator,
|
||||
// nor copy constructor for `has2` type. Supressing those warnings is essential,
|
||||
// nor copy constructor for `has2` type. Suppressing those warnings is essential,
|
||||
// because we treat warnings as errors in those tests
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( push )
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user