From 3b873fb7a9df3b170f2f0ab2db61aaf06c17465a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 6 Oct 2023 10:59:59 -0700 Subject: [PATCH] Fix the static_assert for 128-bit integer types Testing for Standard Library features with compiler version macros was incorrect. This commit fixes that to check the correct macros. That fixes the use of Clang-cl / ICX because Microsoft STL doesn't have support for 128-bit integers (because Microsoft's compiler doesn't) but Clang does. Amends 104a0a9ecdb18d65e4d9075d87e8860c6c9d8335. Fixes: QTBUG-117870 Change-Id: I85599ea5ca7a4b79a8bbfffd178b9688e7c1bf42 Reviewed-by: Volker Hilsheimer (cherry picked from commit 19f54b901ffbc9108875dc0d7d91138bc9d1c1ed) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/global/qtypes.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/corelib/global/qtypes.cpp b/src/corelib/global/qtypes.cpp index 19a7541ed11..9de3960e2fc 100644 --- a/src/corelib/global/qtypes.cpp +++ b/src/corelib/global/qtypes.cpp @@ -513,11 +513,14 @@ static_assert(sizeof(qint128) == 16, "Internal error, qint128 is misdefined"); #endif #ifdef QT_SUPPORTS_INT128 -// check that numeric_limits works: -// This fails here for GCC 9, but succeeds on Clang and GCC >= 11 -// However, all tests in tst_qglobal::int128Literals() pass for GCC 9, too, -// so just suppress the check for older GCC: -# if !defined(Q_CC_GNU_ONLY) || Q_CC_GNU >= 1100 +// Standard Library supports for 128-bit integers: +// Implementation | Version | Note +// ---------------------|---------|------ +// GNU libstdc++ | 11.1.0 | +// LLVM libc++ | 3.5 | May change if compiler has __is_integral() +// MS STL | none | + +# if defined(_LIBCPP_VERSION) || (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 11) static_assert(std::numeric_limits::max() == Q_UINT128_MAX); # endif #endif