Skip to content

Commit 5f3435a

Browse files
derekmaurocopybara-github
authored andcommitted
Fix GCC15 warning that <ciso646> is deprecated in C++17
PiperOrigin-RevId: 752709743 Change-Id: I4d6b52bca913d888818e1380268089743b03ca2b
1 parent fe5a2a4 commit 5f3435a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

absl/hash/internal/hash.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,25 @@
2828
// defined.
2929
#include "absl/base/config.h"
3030

31+
// GCC15 warns that <ciso646> is deprecated in C++17 and suggests using
32+
// <version> instead, even though <version> is not available in C++17 mode prior
33+
// to GCC9.
34+
#if defined(__has_include)
35+
#if __has_include(<version>)
36+
#define ABSL_INTERNAL_VERSION_HEADER_AVAILABLE 1
37+
#endif
38+
#endif
39+
3140
// For feature testing and determining which headers can be included.
32-
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
41+
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L || \
42+
ABSL_INTERNAL_VERSION_HEADER_AVAILABLE
3343
#include <version>
3444
#else
3545
#include <ciso646>
3646
#endif
3747

48+
#undef ABSL_INTERNAL_VERSION_HEADER_AVAILABLE
49+
3850
#include <algorithm>
3951
#include <array>
4052
#include <bitset>

0 commit comments

Comments
 (0)