From 9e5072f1a80b4101d7ae2142287b90021116f3b9 Mon Sep 17 00:00:00 2001 From: Alexey Ochapov Date: Sat, 24 Apr 2021 21:11:43 +0300 Subject: [PATCH] gtest: fix std::is_trivially_copy_constructible for GCC 4.8 & 4.9 properly `std::is_pod` was deprecated in C++20 original (pre `is_pod`) error on GCC 4.8: ``` /fmt/test/gtest/gtest.h: In static member function 'static constexpr bool testing::internal::MatcherBase::IsInlined()': /fmt/test/gtest/gtest.h:6512:12: error: 'is_trivially_copy_constructible' was not declared in this scope std::is_trivially_copy_constructible::value && ^ /fmt/test/gtest/gtest.h:6512:45: error: expected primary-expression before '>' token std::is_trivially_copy_constructible::value && ^ /fmt/test/gtest/gtest.h:6512:46: error: '::value' has not been declared std::is_trivially_copy_constructible::value && ^ ``` --- test/gtest/gtest/gtest.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/gtest/gtest/gtest.h b/test/gtest/gtest/gtest.h index a3c845334934..55a31d0a87dc 100644 --- a/test/gtest/gtest/gtest.h +++ b/test/gtest/gtest/gtest.h @@ -6336,6 +6336,14 @@ struct SharedPayload : SharedPayloadBase { T value; }; +template +using is_trivially_copy_constructible = +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5 + std::has_trivial_copy_constructor; +#else + std::is_trivially_copy_constructible; +#endif + // An internal class for implementing Matcher, which will derive // from it. We put functionalities common to all Matcher // specializations here to avoid code duplication. @@ -6509,7 +6517,7 @@ class MatcherBase : private MatcherDescriberInterface { template static constexpr bool IsInlined() { return sizeof(M) <= sizeof(Buffer) && alignof(M) <= alignof(Buffer) && - std::is_pod::value && + is_trivially_copy_constructible::value && std::is_trivially_destructible::value; }