From 43ff2244066a742bb2aedafd991f0196c6cab03f Mon Sep 17 00:00:00 2001 From: yuyawk Date: Sat, 8 Feb 2025 02:49:20 +0900 Subject: [PATCH] fix: Take C++ version into account when checking `__has_cpp_attribute` --- googletest/include/gtest/internal/gtest-port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index ca18513e..0d669c0c 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -757,7 +757,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #if defined(__has_cpp_attribute) // NOTE: requiring __cplusplus above should not be necessary, but // works around https://bugs.llvm.org/show_bug.cgi?id=23435. -#define GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#define GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(x) GTEST_INTERNAL_CPLUSPLUS_LANG >= __has_cpp_attribute(x) #else #define GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(x) 0 #endif