From f1640d093fa682c98b000e377916cc32b2267e23 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Thu, 23 Aug 2018 03:17:43 -0700 Subject: [PATCH] Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5 std::is_trivially_constructible is equivalent to std::is_trivially_default_constructible std::has_trivial_default_constructor is the GCC < 5 name for std::is_trivially_default_constructible std::is_trivial was also used when compiling with clang, due to clang's use of __GNUC__. Test __clang__ to target the intended implementations. --- src/compat.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compat.h b/src/compat.h index 19f9813fd4..d228611160 100644 --- a/src/compat.h +++ b/src/compat.h @@ -14,10 +14,10 @@ // GCC 4.8 is missing some C++11 type_traits, // https://www.gnu.org/software/gcc/gcc-5/changes.html -#if defined(__GNUC__) && __GNUC__ < 5 -#define IS_TRIVIALLY_CONSTRUCTIBLE std::is_trivial +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5 +#define IS_TRIVIALLY_CONSTRUCTIBLE std::has_trivial_default_constructor #else -#define IS_TRIVIALLY_CONSTRUCTIBLE std::is_trivially_constructible +#define IS_TRIVIALLY_CONSTRUCTIBLE std::is_trivially_default_constructible #endif #ifdef WIN32