Skip to content

Commit 00b2154

Browse files
derekmaurocopybara-github
authored andcommitted
Fix GCC15 warning that <ciso646> is deprecated in C++17
PiperOrigin-RevId: 752706554 Change-Id: I83d35b693efdaabcc63d15169dbf19d63163a563
1 parent cd430b4 commit 00b2154

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

googletest/include/gtest/internal/gtest-port.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,14 @@
282282

283283
// Detect C++ feature test macros as gracefully as possible.
284284
// MSVC >= 19.15, Clang >= 3.4.1, and GCC >= 4.1.2 support feature test macros.
285-
#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L && \
286-
(!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE(<version>))
287-
#include <version> // C++20 and later
288-
#elif (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE(<ciso646>))
285+
//
286+
// GCC15 warns that <ciso646> is deprecated in C++17 and suggests using
287+
// <version> instead, even though <version> is not available in C++17 mode prior
288+
// to GCC9.
289+
#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L || \
290+
GTEST_INTERNAL_HAS_INCLUDE(<version>)
291+
#include <version> // C++20 or <version> support.
292+
#else
289293
#include <ciso646> // Pre-C++20
290294
#endif
291295

0 commit comments

Comments
 (0)