diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-08-27 11:59:42 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-08-27 12:00:21 +0200 |
commit | cb98effc5cf1d6a65a8b4a77872aae1df1ec5fe4 (patch) | |
tree | 441ebb835372548cfbae27e6eac115af4ce1eddc | |
parent | 0ae15bd05f37876dd8050aeba05204225f213b3b (diff) | |
parent | f1640d093fa682c98b000e377916cc32b2267e23 (diff) |
Merge #14031: Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5, don't patch clang
f1640d093fa682c98b000e377916cc32b2267e23 Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5 (Ben Woosley)
Pull request description:
`std::is_trivially_constructible<T>` is equivalent to `std::is_trivially_default_constructible<T>`
`std::has_trivial_default_constructor<T>` is the GCC < 5 name for `std::is_trivially_default_constructible<T>`
https://en.cppreference.com/w/cpp/types/is_default_constructible
https://www.gnu.org/software/gcc/gcc-5/changes.html
`std::is_trivial` was also used when compiling with clang, due to clang's use of `__GNUC__`. Test `__clang__` to target the intended implementations.
https://stackoverflow.com/a/28166605
All callers currently only pass one template argument to IS_TRIVIALLY_CONSTRUCTIBLE, with this change the build would fail if someone attempted passing more.
Tree-SHA512: 3e36ddf20a1c0d76ad94d7c95f3fe5b90f4ee00389d5516b35c657136205e7a3ddff60789b0b0b2375624631f15a51eaad3570ef19a7b9df1469a50ba28415d1
-rw-r--r-- | src/compat.h | 6 |
1 files 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 |