From ad30bf473ba851db746e425ff2b7a0cf672e872f Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Fri, 30 Jan 2015 17:52:03 -0700 Subject: [PATCH 1/4] Correct spelling of "suppress" --- test/is_copy_assignable.cpp | 2 +- test/is_copy_constructible_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/is_copy_assignable.cpp b/test/is_copy_assignable.cpp index 5171b32..d61628f 100644 --- a/test/is_copy_assignable.cpp +++ b/test/is_copy_assignable.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 ) From c348b224dad4b82dbbd602c6ab31269f0818a44d Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 21 Feb 2015 19:06:47 +0000 Subject: [PATCH 2/4] Add intrinsic support for Oracle compiler. --- include/boost/type_traits/intrinsics.hpp | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 3036c58..e8a87b0 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -255,6 +255,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 From 70345d87d353ef6ab6fa8d3bfc9605ac7e386f5b Mon Sep 17 00:00:00 2001 From: akumta Date: Tue, 10 Mar 2015 09:46:46 -0700 Subject: [PATCH 3/4] Update type_with_alignment.hpp Update for ticket # 11096. --- include/boost/type_traits/type_with_alignment.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/type_with_alignment.hpp b/include/boost/type_traits/type_with_alignment.hpp index ad86613..7eb66a7 100644 --- a/include/boost/type_traits/type_with_alignment.hpp +++ b/include/boost/type_traits/type_with_alignment.hpp @@ -176,7 +176,7 @@ class type_with_alignment { }; -#if defined(__GNUC__) +#if defined(__GNUC__) || (defined (__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) namespace tt_align_ns { struct __attribute__((__aligned__(2))) a2 {}; struct __attribute__((__aligned__(4))) a4 {}; From 24b7d226d3316d36711c40b7ca854c2b2d4565be Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 16 May 2015 18:39:49 +0100 Subject: [PATCH 4/4] Add fix for false positives in is_virtual_base_of See https://svn.boost.org/trac/boost/ticket/11309 --- include/boost/type_traits/is_virtual_base_of.hpp | 15 +++++++++++++++ test/is_virtual_base_of_test.cpp | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/boost/type_traits/is_virtual_base_of.hpp b/include/boost/type_traits/is_virtual_base_of.hpp index 33db914..3daad1b 100644 --- a/include/boost/type_traits/is_virtual_base_of.hpp +++ b/include/boost/type_traits/is_virtual_base_of.hpp @@ -36,6 +36,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 { @@ -43,6 +54,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 { @@ -50,6 +62,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 @@ -58,6 +71,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 { @@ -65,6 +79,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/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