From 9ab3aae3e6c412a177f2da906673ff3ddc517daf Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 16 Jun 2015 18:42:55 +0100 Subject: [PATCH] Fix use of is_constructible - to limits to cases where it's really needed. And to not use it when the compiler would choke. --- .../type_traits/has_trivial_constructor.hpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/boost/type_traits/has_trivial_constructor.hpp b/include/boost/type_traits/has_trivial_constructor.hpp index 60ac52a..3fca9bf 100644 --- a/include/boost/type_traits/has_trivial_constructor.hpp +++ b/include/boost/type_traits/has_trivial_constructor.hpp @@ -24,17 +24,34 @@ #endif #endif + +#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) +#include +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_default_constructible::value +#else +// +// Mot all compilers, particularly older GCC versions can handle the fix above. +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX +#endif + namespace boost { template struct has_trivial_constructor #ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR - : public integral_constant ::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) && is_default_constructible::value)>{}; + : public integral_constant ::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) BOOST_TT_TRIVIAL_CONSTRUCT_FIX)>{}; #else : public integral_constant ::value>{}; #endif +template <> struct has_trivial_constructor : public boost::false_type{}; +template <> struct has_trivial_constructor : public boost::false_type{}; +template <> struct has_trivial_constructor : public boost::false_type{}; +template <> struct has_trivial_constructor : public boost::false_type{}; + template struct has_trivial_default_constructor : public has_trivial_constructor {}; +#undef BOOST_TT_TRIVIAL_CONSTRUCT_FIX + } // namespace boost #endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED