diff options
author | Dino Radakovic <dinor@google.com> | 2023-04-28 17:15:31 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-28 17:16:07 (GMT) |
commit | 797b0ad2a3a45608ecf5c67e6e289d377a3521ca (patch) | |
tree | 9e42decf174d0cf8518729fae4cce8b867033b56 /googletest | |
parent | 0bdaac5a1401fffac6b64581efc639734aded793 (diff) | |
download | googletest-797b0ad2a3a45608ecf5c67e6e289d377a3521ca.zip googletest-797b0ad2a3a45608ecf5c67e6e289d377a3521ca.tar.gz googletest-797b0ad2a3a45608ecf5c67e6e289d377a3521ca.tar.bz2 |
Use GTEST_INTERNAL_CPLUSPLUS_LANG instead of __cplusplus
Some versions of MSVC provide incorrect values for the latter and rely on _MSVC_LANG instead.
Fixes #4226.
PiperOrigin-RevId: 527919195
Change-Id: Ifcca4612074f5ebc5337094426866a187f79f90a
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index c6bc2d7..d71110c 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -2398,7 +2398,7 @@ using Any = ::absl::any; } // namespace testing #else #ifdef __has_include -#if __has_include(<any>) && __cplusplus >= 201703L && \ +#if __has_include(<any>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L && \ (!defined(_MSC_VER) || GTEST_HAS_RTTI) // Otherwise for C++17 and higher use std::any for UniversalPrinter<> // specializations. @@ -2411,7 +2411,7 @@ using Any = ::std::any; } // namespace testing // The case where absl is configured NOT to alias std::any is not // supported. -#endif // __has_include(<any>) && __cplusplus >= 201703L +#endif // __has_include(<any>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L #endif // __has_include #endif // GTEST_HAS_ABSL @@ -2433,7 +2433,7 @@ inline ::absl::nullopt_t Nullopt() { return ::absl::nullopt; } } // namespace testing #else #ifdef __has_include -#if __has_include(<optional>) && __cplusplus >= 201703L +#if __has_include(<optional>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L // Otherwise for C++17 and higher use std::optional for UniversalPrinter<> // specializations. #define GTEST_INTERNAL_HAS_OPTIONAL 1 @@ -2447,7 +2447,7 @@ inline ::std::nullopt_t Nullopt() { return ::std::nullopt; } } // namespace testing // The case where absl is configured NOT to alias std::optional is not // supported. -#endif // __has_include(<optional>) && __cplusplus >= 201703L +#endif // __has_include(<optional>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L #endif // __has_include #endif // GTEST_HAS_ABSL @@ -2467,7 +2467,7 @@ using StringView = ::absl::string_view; } // namespace testing #else #ifdef __has_include -#if __has_include(<string_view>) && __cplusplus >= 201703L +#if __has_include(<string_view>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L // Otherwise for C++17 and higher use std::string_view for Matcher<> // specializations. #define GTEST_INTERNAL_HAS_STRING_VIEW 1 @@ -2479,7 +2479,8 @@ using StringView = ::std::string_view; } // namespace testing // The case where absl is configured NOT to alias std::string_view is not // supported. -#endif // __has_include(<string_view>) && __cplusplus >= 201703L +#endif // __has_include(<string_view>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= + // 201703L #endif // __has_include #endif // GTEST_HAS_ABSL @@ -2500,7 +2501,7 @@ using Variant = ::absl::variant<T...>; } // namespace testing #else #ifdef __has_include -#if __has_include(<variant>) && __cplusplus >= 201703L +#if __has_include(<variant>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L // Otherwise for C++17 and higher use std::variant for UniversalPrinter<> // specializations. #define GTEST_INTERNAL_HAS_VARIANT 1 @@ -2512,7 +2513,7 @@ using Variant = ::std::variant<T...>; } // namespace internal } // namespace testing // The case where absl is configured NOT to alias std::variant is not supported. -#endif // __has_include(<variant>) && __cplusplus >= 201703L +#endif // __has_include(<variant>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L #endif // __has_include #endif // GTEST_HAS_ABSL |