From cf9b8b4633663d764325693ef7cd4e599a99e9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8ger=20Hanseg=C3=A5rd?= Date: Wed, 19 Jun 2024 16:12:14 +0200 Subject: [PATCH] Only include if __cpp_lib_format is defined With C++ 17, MSVC evaluates __has_include() to true and does not prevent inclusion of the header. This leads to build warnings: STL4038: The contents of are available only with C++20 or later. Because of similar issues with GCC, we stopped using __has_include for feature detection, and instead require C++20 to be available, even in C++17 builds, cf. b2ed29b8d9b33dcece83000aee28073dd27f1cd9. Since we include centrally these days, we can just use the feature test macro, __cpp_lib_format, directly. Amends ffac33964d51971a1c1f61308b6f0a60a4133296. Task-number: QTBUG-104654 Pick-to: 6.8 Change-Id: Ie923af92a7f8ab19cbd9cac9307f3f2e9a72e316 Reviewed-by: Marc Mutz --- src/corelib/io/qtformat_impl.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/corelib/io/qtformat_impl.h b/src/corelib/io/qtformat_impl.h index 7c7029d7799..31031324ae6 100644 --- a/src/corelib/io/qtformat_impl.h +++ b/src/corelib/io/qtformat_impl.h @@ -12,12 +12,9 @@ #include #include -#if __has_include() -# include -#endif - #if (defined(__cpp_lib_format) && (__cpp_lib_format >= 202106L)) +#include #define QT_SUPPORTS_STD_FORMAT 1 #endif // __cpp_lib_format