From 32b0a27d56eefeac3a53f292cf1541550cb352fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8ger=20Hanseg=C3=A5rd?= Date: Mon, 11 Mar 2024 22:12:12 +0200 Subject: [PATCH] QMap: Use qHash SFINAE workaround with MSVC Fixes failure to find qHash functions when building Squish. Here, QMap is used with custom types that do not have any associated qHash functions. It should therefore not require a qHash function to be usable with QMap. There is no indication in the build output where the instantiation came from. There's nothing in the output about the function it should have called, likely because no qHash functions exists. Amends: e1f45ad8187947e243c8247c5cbac2d884d68d55 Fixes: QTBUG-123310 Change-Id: Idb12fb6ffab06ce242c43f2c42ea7a105e8fa0f4 Reviewed-by: Thiago Macieira Reviewed-by: Marc Mutz --- src/corelib/tools/qmap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 6daab908bb6..7ee0be1e519 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -783,8 +783,8 @@ private: #ifdef Q_QDOC friend size_t qHash(const QMap &key, size_t seed = 0); #else -# ifdef Q_CC_GHS - // GHS tries to intantiate qHash() for the noexcept running into a +# if defined(Q_CC_GHS) || defined (Q_CC_MSVC) + // GHS and MSVC tries to intantiate qHash() for the noexcept running into a // non-SFINAE'ed hard error... Create an artificial SFINAE context as a // work-around: template , bool> = true>