fix-gcc16-sfinae-qbitarray.patch raw

   1  From 679e8bda1eb0cc98acb981e9a10204bed1c179f2 Mon Sep 17 00:00:00 2001
   2  From: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
   3  Date: Tue, 20 Jan 2026 15:23:31 +0100
   4  Subject: [PATCH] qhashfunctions.h: include QBitArray
   5  
   6  In qhashfunctions.h we're declaring a std::hash specialization for
   7  QBitArray. That specialization instantiates
   8  QNothrowHashable_v<QBitArray>, which checks if qHash(QBitArray) is
   9  noexcept.
  10  
  11  The problem is that there are already qHash(QByteArrayView) and
  12  qHash(QStringView) around, which will be picked up by overload
  13  resolution. That, in turn, will try to instantiate the QBAV/QSV
  14  constructors from a generic container. That instantiation will fail
  15  because QBitArray is not complete yet.
  16  
  17  When we later complete QBitArray, GCC is going to complain.
  18  
  19  Therefore, complete QBitArray before attempting SFINAE tricks on it.
  20  
  21  As an alternative, I could've moved the std::hash specialization
  22  to qbitarray.h. However I noticed that qHash(QBitArray) is still
  23  declared into qhashfunctions.h, i.e. hashing QBitArrays didn't
  24  require the full type, and therefore moving std::hash would've been
  25  a potential SIC?
  26  
  27  Task-number: QTBUG-143470
  28  Change-Id: Ie79d15e77d1fb3c86de6d7480a66bddc39f17666
  29  Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
  30  ---
  31   src/corelib/tools/qhashfunctions.h | 5 +++--
  32   1 file changed, 3 insertions(+), 2 deletions(-)
  33  
  34  diff --git a/qtbase/src/corelib/tools/qhashfunctions.h b/qtbase/src/corelib/tools/qhashfunctions.h
  35  index 8f1394c8ad35..beef80557865 100644
  36  --- a/qtbase/src/corelib/tools/qhashfunctions.h
  37  +++ b/qtbase/src/corelib/tools/qhashfunctions.h
  38  @@ -8,6 +8,9 @@
  39  
  40   #include <QtCore/qstring.h>
  41   #include <QtCore/qstringfwd.h>
  42  +#ifndef QT_BOOTSTRAPPED
  43  +#include <QtCore/qbitarray.h>
  44  +#endif
  45  
  46   #include <numeric> // for std::accumulate
  47   #include <functional> // for std::hash
  48  @@ -25,8 +28,6 @@
  49  
  50   QT_BEGIN_NAMESPACE
  51  
  52  -class QBitArray;
  53  -
  54   #if QT_DEPRECATED_SINCE(6,6)
  55   QT_DEPRECATED_VERSION_X_6_6("Use QHashSeed instead")
  56   Q_CORE_EXPORT int qGlobalQHashSeed();
  57