diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index d66996a..4533114 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -266,6 +266,34 @@ # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif +#if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) +# include +# include +# include + +# 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::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__oracle_has_trivial_copy(T) && !is_reference::value && ! ::boost::is_volatile::value) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile::value && ! ::boost::is_const::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::value && !is_reference::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_const::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::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 # include diff --git a/include/boost/type_traits/is_virtual_base_of.hpp b/include/boost/type_traits/is_virtual_base_of.hpp index 4bd60d3..f005256 100644 --- a/include/boost/type_traits/is_virtual_base_of.hpp +++ b/include/boost/type_traits/is_virtual_base_of.hpp @@ -31,6 +31,17 @@ struct is_virtual_base_of_impl template struct is_virtual_base_of_impl { + 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 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 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 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 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))); diff --git a/include/boost/type_traits/type_with_alignment.hpp b/include/boost/type_traits/type_with_alignment.hpp index 3fbb213..bfd5476 100644 --- a/include/boost/type_traits/type_with_alignment.hpp +++ b/include/boost/type_traits/type_with_alignment.hpp @@ -84,7 +84,7 @@ struct type_with_alignment typedef typename boost::detail::char_alignment::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 {}; diff --git a/test/is_copy_assignable_test.cpp b/test/is_copy_assignable_test.cpp index 5171b32..d61628f 100644 --- a/test/is_copy_assignable_test.cpp +++ b/test/is_copy_assignable_test.cpp @@ -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 ) diff --git a/test/is_copy_constructible_test.cpp b/test/is_copy_constructible_test.cpp index 23b58a4..cbc4030 100644 --- a/test/is_copy_constructible_test.cpp +++ b/test/is_copy_constructible_test.cpp @@ -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 ) diff --git a/test/is_virtual_base_of_test.cpp b/test/is_virtual_base_of_test.cpp index 2877b4a..256e67c 100644 --- a/test/is_virtual_base_of_test.cpp +++ b/test/is_virtual_base_of_test.cpp @@ -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::value), false); @@ -75,6 +82,12 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of:: BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), false); +// +// Bug cases: +// +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), true); + TT_TEST_END