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 104a0a9ecd.

Fixes: QTBUG-117870
Pick-to: 6.6
Change-Id: I85599ea5ca7a4b79a8bbfffd178b9688e7c1bf42
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Thiago Macieira 2023-10-06 10:59:59 -07:00
parent 1f2f2b6357
commit 19f54b901f

View File

@ -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<quint128>::max() == Q_UINT128_MAX);
# endif
#endif