From 9b12c8ad6a0e9947c5bf930e782dd3f4d0fc6dba Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 10 Nov 2014 17:58:14 +0000 Subject: [PATCH 1/5] Fix for CUDA on Clang compilation failure when including type traits headers. See https://svn.boost.org/trac/boost/ticket/10694. --- include/boost/type_traits/intrinsics.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 8bccb6f..af29da5 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -132,7 +132,13 @@ # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif -#if defined(BOOST_CLANG) && defined(__has_feature) +#if defined(BOOST_CLANG) && defined(__has_feature) && !defined(__CUDACC__) +// +// Note that these intrinsics are disabled for the CUDA meta-compiler as it appears +// to not support them, even though the underlying clang compiler does so. +// This is a rubbish fix as it basically stops type traits from working correctly, +// but maybe the best we can do for now. See https://svn.boost.org/trac/boost/ticket/10694 +// # include # include # include From c76c7cc1ad5ac6dc89097fa2d5b04ecbf04339f0 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 10 Nov 2014 18:01:17 +0000 Subject: [PATCH 2/5] Update history and regen docs. --- doc/history.qbk | 4 ++++ doc/html/boost_typetraits/history.html | 22 +++++++++++++++------- doc/html/index/s11.html | 2 +- doc/html/index/s12.html | 2 +- doc/html/index/s13.html | 2 +- doc/html/index/s14.html | 2 +- 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/doc/history.qbk b/doc/history.qbk index d1c8672..ad97420 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -7,6 +7,10 @@ [section:history History] +[h4 Boost 1.58.0] + +* Fixed issue with CUDA on Clang compiler see [@https://svn.boost.org/trac/boost/ticket/10694 #10694]. + [h4 Boost 1.57.0] * Added new traits __is_copy_assignable and __is_final. diff --git a/doc/html/boost_typetraits/history.html b/doc/html/boost_typetraits/history.html index e37dcde..0fc777b 100644 --- a/doc/html/boost_typetraits/history.html +++ b/doc/html/boost_typetraits/history.html @@ -28,6 +28,14 @@
+ Boost + 1.58.0 +
+
  • + Fixed issue with CUDA on Clang compiler see #10694. +
+
+ Boost 1.57.0
@@ -41,7 +49,7 @@
- + Boost 1.56.0
@@ -50,7 +58,7 @@ #9474.
- + Boost 1.55.0
@@ -58,7 +66,7 @@ Added new trait is_copy_constructible.
- + Boost 1.54.0
@@ -69,7 +77,7 @@ has_trivial_move_constructor.
- + Boost 1.47.0
@@ -84,7 +92,7 @@
- + Boost 1.45.0
@@ -101,7 +109,7 @@
- + Boost 1.44.0
@@ -118,7 +126,7 @@
- + Boost 1.42.0
diff --git a/doc/html/index/s11.html b/doc/html/index/s11.html index 7c569b9..855205a 100644 --- a/doc/html/index/s11.html +++ b/doc/html/index/s11.html @@ -24,7 +24,7 @@

-Class Index

+Class Index

A C D E F H I M N O P R T

diff --git a/doc/html/index/s12.html b/doc/html/index/s12.html index f8fe8cb..545f9fe 100644 --- a/doc/html/index/s12.html +++ b/doc/html/index/s12.html @@ -24,7 +24,7 @@

-Typedef Index

+Typedef Index

A F R T

diff --git a/doc/html/index/s13.html b/doc/html/index/s13.html index 0cc7861..b579aba 100644 --- a/doc/html/index/s13.html +++ b/doc/html/index/s13.html @@ -24,7 +24,7 @@

-Macro Index

+Macro Index

B

diff --git a/doc/html/index/s14.html b/doc/html/index/s14.html index e96ebc2..223ce08 100644 --- a/doc/html/index/s14.html +++ b/doc/html/index/s14.html @@ -23,7 +23,7 @@

-Index

+Index

A B C D E F H I M N O P R T U

From ffa9927732ad3ba18ea5bc481b0d70c271d0898b Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 5 Dec 2014 18:30:54 +0000 Subject: [PATCH 3/5] Add new hooks for nothrow move assign/construct and fix is_nothrow_move_assignable and is_nothrow_move_constructible for msvc-12 and later. --- doc/html/boost_typetraits/intrinsics.html | 24 +++++++++++++++++++ doc/html/index/s11.html | 2 +- doc/html/index/s12.html | 2 +- doc/html/index/s13.html | 10 +++++++- doc/html/index/s14.html | 12 +++++++++- doc/intrinsics.qbk | 2 ++ include/boost/type_traits/intrinsics.hpp | 7 +++++- .../is_nothrow_move_assignable.hpp | 18 +++++++++++++- .../is_nothrow_move_constructible.hpp | 21 +++++++++++++++- test/is_nothrow_move_assignable_test.cpp | 8 ++----- test/is_nothrow_move_constructible_test.cpp | 8 ++----- 11 files changed, 95 insertions(+), 19 deletions(-) diff --git a/doc/html/boost_typetraits/intrinsics.html b/doc/html/boost_typetraits/intrinsics.html index 80d5626..483202f 100644 --- a/doc/html/boost_typetraits/intrinsics.html +++ b/doc/html/boost_typetraits/intrinsics.html @@ -284,6 +284,30 @@ + +

+ BOOST_IS_NOTHROW_MOVE_ASSIGN(T) +

+ + +

+ Should evaluate to true T has a non-throwing move assign operator. +

+ + + + +

+ BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) +

+ + +

+ Should evaluate to true T has a non-throwing move constructor. +

+ + +

BOOST_IS_ABSTRACT(T) diff --git a/doc/html/index/s11.html b/doc/html/index/s11.html index 855205a..8564cde 100644 --- a/doc/html/index/s11.html +++ b/doc/html/index/s11.html @@ -24,7 +24,7 @@

-Class Index

+Class Index

A C D E F H I M N O P R T

diff --git a/doc/html/index/s12.html b/doc/html/index/s12.html index 545f9fe..1b68205 100644 --- a/doc/html/index/s12.html +++ b/doc/html/index/s12.html @@ -24,7 +24,7 @@

-Typedef Index

+Typedef Index

A F R T

diff --git a/doc/html/index/s13.html b/doc/html/index/s13.html index b579aba..c43284f 100644 --- a/doc/html/index/s13.html +++ b/doc/html/index/s13.html @@ -24,7 +24,7 @@

-Macro Index

+Macro Index

B

@@ -148,6 +148,14 @@
  • +

    BOOST_IS_NOTHROW_MOVE_ASSIGN

    + +
  • +
  • +

    BOOST_IS_NOTHROW_MOVE_CONSTRUCT

    + +
  • +
  • BOOST_IS_POD

    • is_pod

    • diff --git a/doc/html/index/s14.html b/doc/html/index/s14.html index 223ce08..e99b032 100644 --- a/doc/html/index/s14.html +++ b/doc/html/index/s14.html @@ -23,7 +23,7 @@

    -Index

    +Index

    A B C D E F H I M N O P R T U

    @@ -193,6 +193,14 @@
  • +

    BOOST_IS_NOTHROW_MOVE_ASSIGN

    + +
  • +
  • +

    BOOST_IS_NOTHROW_MOVE_CONSTRUCT

    + +
  • +
  • BOOST_IS_POD

    • is_pod

    • @@ -844,6 +852,8 @@
    • BOOST_IS_EMPTY

    • BOOST_IS_ENUM

    • BOOST_IS_FINAL

    • +
    • BOOST_IS_NOTHROW_MOVE_ASSIGN

    • +
    • BOOST_IS_NOTHROW_MOVE_CONSTRUCT

    • BOOST_IS_POD

    • BOOST_IS_POLYMORPHIC

    • BOOST_IS_UNION

    • diff --git a/doc/intrinsics.qbk b/doc/intrinsics.qbk index 4967e47..c02e5c8 100644 --- a/doc/intrinsics.qbk +++ b/doc/intrinsics.qbk @@ -61,6 +61,8 @@ a matter of defining one of more of the following macros: [[BOOST_HAS_NOTHROW_COPY(T)][Should evaluate to true if `T(t)` can not throw]] [[BOOST_HAS_NOTHROW_ASSIGN(T)][Should evaluate to true if `T t, u; t = u` can not throw]] [[BOOST_HAS_VIRTUAL_DESTRUCTOR(T)][Should evaluate to true T has a virtual destructor]] + [[BOOST_IS_NOTHROW_MOVE_ASSIGN(T)][Should evaluate to true T has a non-throwing move assign operator.]] + [[BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T)][Should evaluate to true T has a non-throwing move constructor.]] [[BOOST_IS_ABSTRACT(T)][Should evaluate to true if T is an abstract type]] [[BOOST_IS_BASE_OF(T,U)][Should evaluate to true if T is a base class of U]] diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index af29da5..7bd0b71 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -32,6 +32,8 @@ // BOOST_HAS_NOTHROW_COPY(T) should evaluate to true if T(t) can not throw // BOOST_HAS_NOTHROW_ASSIGN(T) should evaluate to true if t = u can not throw // BOOST_HAS_VIRTUAL_DESTRUCTOR(T) should evaluate to true T has a virtual destructor +// BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) should evaluate to true if T has a non-throwing move constructor. +// BOOST_IS_NOTHROW_MOVE_ASSIGN(T) should evaluate to true if T has a non-throwing move assignment operator. // // The following can also be defined: when detected our implementation is greatly simplified. // @@ -112,7 +114,10 @@ # define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || __is_pod(T)) && !::boost::is_volatile::value && !::boost::is_reference::value) # define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || __is_pod(T)) && ! ::boost::is_const::value && !::boost::is_volatile::value && !::boost::is_reference::value) # endif - +#if _MSC_FULL_VER < 180020827 +# define BOOST_IS_NOTHROW_MOVE_ASSIGN(T) (__is_nothrow_assignable(T&, T&&)) +# define BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) (__is_nothrow_constructible(T, T&&)) +#endif # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif diff --git a/include/boost/type_traits/is_nothrow_move_assignable.hpp b/include/boost/type_traits/is_nothrow_move_assignable.hpp index 7acbcce..3268307 100644 --- a/include/boost/type_traits/is_nothrow_move_assignable.hpp +++ b/include/boost/type_traits/is_nothrow_move_assignable.hpp @@ -29,7 +29,23 @@ namespace boost { namespace detail{ -#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) +#ifdef BOOST_IS_NOTHROW_MOVE_ASSIGN + +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_NOTHROW_MOVE_ASSIGN(T)); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; + + +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) template struct false_or_cpp11_noexcept_move_assignable: public ::boost::false_type {}; diff --git a/include/boost/type_traits/is_nothrow_move_constructible.hpp b/include/boost/type_traits/is_nothrow_move_constructible.hpp index b8a657a..c09d5d1 100644 --- a/include/boost/type_traits/is_nothrow_move_constructible.hpp +++ b/include/boost/type_traits/is_nothrow_move_constructible.hpp @@ -12,6 +12,7 @@ #define BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED #include +#include #include #include #include @@ -28,7 +29,25 @@ namespace boost { namespace detail{ -#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) +#ifdef BOOST_IS_NOTHROW_MOVE_CONSTRUCT + +template +struct is_nothrow_move_constructible_imp{ + BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T)); +}; + +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type {}; +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type{}; +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type{}; +#endif + +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) template struct false_or_cpp11_noexcept_move_constructible: public ::boost::false_type {}; diff --git a/test/is_nothrow_move_assignable_test.cpp b/test/is_nothrow_move_assignable_test.cpp index 7522a6e..9240a0e 100644 --- a/test/is_nothrow_move_assignable_test.cpp +++ b/test/is_nothrow_move_assignable_test.cpp @@ -195,12 +195,13 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, false); -#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) +#if (!defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)) || defined(BOOST_IS_NOTHROW_MOVE_ASSIGN) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); #else // cases we would like to succeed but can't implement in the language: BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true, false); @@ -211,11 +212,6 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, false); - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_NOEXCEPT) -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); -#endif - BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, false); TT_TEST_END diff --git a/test/is_nothrow_move_constructible_test.cpp b/test/is_nothrow_move_constructible_test.cpp index 6f6ccfb..9d258ae 100644 --- a/test/is_nothrow_move_constructible_test.cpp +++ b/test/is_nothrow_move_constructible_test.cpp @@ -191,12 +191,13 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::va BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); -#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) +#if (!defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)) || defined(BOOST_IS_NOTHROW_MOVE_CONSTRUCT) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); #else // cases we would like to succeed but can't implement in the language: BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true, false); @@ -207,11 +208,6 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_NOEXCEPT) -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); -#endif - BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); TT_TEST_END From cf42ce1cfd7c0fc1222bb14e49d4cd173b273e1b Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 6 Dec 2014 09:38:35 +0000 Subject: [PATCH 4/5] Fix version check. --- include/boost/type_traits/intrinsics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 7bd0b71..3036c58 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -114,7 +114,7 @@ # define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || __is_pod(T)) && !::boost::is_volatile::value && !::boost::is_reference::value) # define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || __is_pod(T)) && ! ::boost::is_const::value && !::boost::is_volatile::value && !::boost::is_reference::value) # endif -#if _MSC_FULL_VER < 180020827 +#if _MSC_FULL_VER >= 180020827 # define BOOST_IS_NOTHROW_MOVE_ASSIGN(T) (__is_nothrow_assignable(T&, T&&)) # define BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) (__is_nothrow_constructible(T, T&&)) #endif From 6a8708a12834707f9306d042d36fdee6a5762c7c Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Dec 2014 15:49:21 +0000 Subject: [PATCH 5/5] Update history. --- doc/history.qbk | 1 + doc/html/boost_typetraits/history.html | 11 +++++++++-- doc/html/index/s11.html | 2 +- doc/html/index/s12.html | 2 +- doc/html/index/s13.html | 2 +- doc/html/index/s14.html | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/history.qbk b/doc/history.qbk index ad97420..0d35f97 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -10,6 +10,7 @@ [h4 Boost 1.58.0] * Fixed issue with CUDA on Clang compiler see [@https://svn.boost.org/trac/boost/ticket/10694 #10694]. +* Fixed __is_nothrow_move_assignable and __is_nothrow_move_constructible to work on VC12 and later. [h4 Boost 1.57.0] diff --git a/doc/html/boost_typetraits/history.html b/doc/html/boost_typetraits/history.html index 0fc777b..363d9cd 100644 --- a/doc/html/boost_typetraits/history.html +++ b/doc/html/boost_typetraits/history.html @@ -31,9 +31,16 @@ Boost 1.58.0 -
      Boost diff --git a/doc/html/index/s11.html b/doc/html/index/s11.html index 8564cde..d9daf0a 100644 --- a/doc/html/index/s11.html +++ b/doc/html/index/s11.html @@ -24,7 +24,7 @@

    -Class Index

    +Class Index

    A C D E F H I M N O P R T

    diff --git a/doc/html/index/s12.html b/doc/html/index/s12.html index 1b68205..b0d9b57 100644 --- a/doc/html/index/s12.html +++ b/doc/html/index/s12.html @@ -24,7 +24,7 @@

    -Typedef Index

    +Typedef Index

    A F R T

    diff --git a/doc/html/index/s13.html b/doc/html/index/s13.html index c43284f..91c0605 100644 --- a/doc/html/index/s13.html +++ b/doc/html/index/s13.html @@ -24,7 +24,7 @@

    -Macro Index

    +Macro Index

    B

    diff --git a/doc/html/index/s14.html b/doc/html/index/s14.html index e99b032..125a982 100644 --- a/doc/html/index/s14.html +++ b/doc/html/index/s14.html @@ -23,7 +23,7 @@

    -Index

    +Index

    A B C D E F H I M N O P R T U