From 18c6bc3dc4123f688943824d3a1cf31dc29c1642 Mon Sep 17 00:00:00 2001 From: "Manikandan K. S." Date: Sun, 5 Jul 2026 09:03:35 +0530 Subject: [PATCH] fix: only use __cpp_lib_three_way_comparison for detection The fallback check GTEST_INTERNAL_HAS_INCLUDE() && C++20 causes build failures on Android NDK 24 which has the header but lacks the full comparison operators needed by PrintTo. The feature test macro __cpp_lib_three_way_comparison is the reliable indicator. Fixes #4933 --- googletest/include/gtest/internal/gtest-port.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index b607e0ade..650a04558 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -2411,9 +2411,7 @@ using StringView = ::std::string_view; #define GTEST_INTERNAL_HAS_STRING_VIEW 0 #endif -#if (defined(__cpp_lib_three_way_comparison) || \ - (GTEST_INTERNAL_HAS_INCLUDE() && \ - GTEST_INTERNAL_CPLUSPLUS_LANG >= 201907L)) +#if defined(__cpp_lib_three_way_comparison) #define GTEST_INTERNAL_HAS_COMPARE_LIB 1 #else #define GTEST_INTERNAL_HAS_COMPARE_LIB 0