Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-139992

unreachable code warning on Windows 32-bit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.9.2, 6.10.0 Beta3
    • None
    • Windows

      Qt build for Windows 32-bit triggers warning C4702 in qhashfunctions.h

      C:\Qt\6.9.2\msvc2022_32\include\QtCore\qhashfunctions.h(144,1): warning C4702: unreachable code

      This can be fixed here with:

      Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(qint64 key, size_t seed = 0) noexcept
      {
          if constexpr (sizeof(qint64) > sizeof(size_t)) {
              // Avoid QTBUG-116080: we XOR the top half with its own sign bit:
              // - if the qint64 is in range of qint32, then signmask ^ high == 0
              //   (for Qt 7 only)
              // - if the qint64 is in range of quint32, then signmask == 0 and we
              //   do the same as the quint64 overload above
              quint32 high = quint32(quint64(key) >> 32);
              quint32 low = quint32(quint64(key));
              quint32 signmask = qint32(high) >> 31;  // all zeroes or all ones
              signmask = QT_VERSION_MAJOR > 6 ? signmask : 0;
              low ^= signmask ^ high;
              return qHash(low, seed);
          } else {
              return qHash(quint64(key), seed);
          }
      } 

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            anoymouserver anoymouserver
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes