diff options
author | Dino Radakovic <dinor@google.com> | 2023-02-22 17:02:08 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-02-22 17:02:55 (GMT) |
commit | 39a26e12d67ed6c21feeb606372bfee39a8e6d53 (patch) | |
tree | 6cfaa0831c746a1fb65632c5f6152045a7b069ac /googletest/include | |
parent | d9a4bbcaf22d7cb37e42af3103019060d11bce3d (diff) | |
download | googletest-39a26e12d67ed6c21feeb606372bfee39a8e6d53.zip googletest-39a26e12d67ed6c21feeb606372bfee39a8e6d53.tar.gz googletest-39a26e12d67ed6c21feeb606372bfee39a8e6d53.tar.bz2 |
Avoid redundant declaration of static constexpr members in c++17
Keep declarations in c++ < 17 using new macro, GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL.
Fixes #4148.
PiperOrigin-RevId: 511510401
Change-Id: I76c3f2fccf07a0978adcbe5f8f0203b9d0c33872
Diffstat (limited to 'googletest/include')
-rw-r--r-- | googletest/include/gtest/internal/gtest-internal.h | 2 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index e1eb2b5..7339504 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -900,8 +900,10 @@ class HasDebugStringAndShortDebugString { HasDebugStringType::value && HasShortDebugStringType::value; }; +#ifdef GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL template <typename T> constexpr bool HasDebugStringAndShortDebugString<T>::value; +#endif // When the compiler sees expression IsContainerTest<C>(0), if C is an // STL-style container class, the first overload of IsContainerTest diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index ae7fb35..5cea3e0 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -2447,4 +2447,9 @@ using Variant = ::std::variant<T...>; #endif // __has_include #endif // GTEST_HAS_ABSL +#if defined(GTEST_INTERNAL_CPLUSPLUS_LANG) && \ + GTEST_INTERNAL_CPLUSPLUS_LANG < 201703L +#define GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1 +#endif + #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ |