gtest: fix std::is_trivially_copy_constructible for GCC 4.8 & 4.9 properly

`std::is_pod<T>` 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<T>::IsInlined()':
/fmt/test/gtest/gtest.h:6512:12: error: 'is_trivially_copy_constructible' was not declared in this scope
            std::is_trivially_copy_constructible<M>::value &&
            ^
/fmt/test/gtest/gtest.h:6512:45: error: expected primary-expression before '>' token
            std::is_trivially_copy_constructible<M>::value &&
                                                  ^
/fmt/test/gtest/gtest.h:6512:46: error: '::value' has not been declared
            std::is_trivially_copy_constructible<M>::value &&
                                                   ^
```
This commit is contained in:
Alexey Ochapov 2021-04-24 21:11:43 +03:00 committed by Victor Zverovich
parent 3d51ccdaae
commit fd43e4dcbc

View File

@ -6336,6 +6336,14 @@ struct SharedPayload : SharedPayloadBase {
T value;
};
template <typename T>
using is_trivially_copy_constructible =
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
std::has_trivial_copy_constructor<T>;
#else
std::is_trivially_copy_constructible<T>;
#endif
// An internal class for implementing Matcher<T>, which will derive
// from it. We put functionalities common to all Matcher<T>
// specializations here to avoid code duplication.
@ -6509,7 +6517,7 @@ class MatcherBase : private MatcherDescriberInterface {
template <typename M>
static constexpr bool IsInlined() {
return sizeof(M) <= sizeof(Buffer) && alignof(M) <= alignof(Buffer) &&
std::is_pod<M>::value &&
is_trivially_copy_constructible<M>::value &&
std::is_trivially_destructible<M>::value;
}