Skip to content

Commit

Permalink
gtest: fix std::is_trivially_copy_constructible for gcc 4.8
Browse files Browse the repository at this point in the history
error:
```
/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 &&
```
  • Loading branch information
alexezeder committed Apr 24, 2021
1 parent 3f4a99b commit 7d5d037
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/gtest/gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -6272,6 +6272,14 @@ class MatcherInterface : public MatcherDescriberInterface {

namespace internal {

#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
template<typename T>
using is_trivially_copy_constructible = std::has_trivial_copy_constructor<T>;
#else
template<typename T>
using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>;
#endif

struct AnyEq {
template <typename A, typename B>
bool operator()(const A& a, const B& b) const { return a == b; }
Expand Down Expand Up @@ -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_trivially_copy_constructible<M>::value &&
is_trivially_copy_constructible<M>::value &&
std::is_trivially_destructible<M>::value;
}

Expand Down

0 comments on commit 7d5d037

Please sign in to comment.