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

qtestcase.h may need a fix to avoid unreachable code warning.

    XMLWordPrintable

Details

    • cf5da3336 (dev), 139e5b55e (6.5), 4df0132ad (6.6)

    Description

      The following piece of code may cause unreachable code error since the second return may never be reached.

          inline typename std::enable_if<!QtPrivate::IsQEnumHelper<T>::Value && !std::is_enum_v<T>, char *>::type toString(const T &t)
          {
      #ifndef QT_NO_DEBUG_STREAM
              if constexpr (QTypeTraits::has_ostream_operator_v<QDebug, T>) {
                  return qstrdup(QDebug::toString(t).toUtf8().constData());
              } else {
                  static_assert(!QMetaTypeId2<T>::IsBuiltIn,
                              "Built-in type must implement debug streaming operator "
                              "or provide QTest::toString specialization");
              }
      #endif
              return nullptr;
          }
      

      Attachments

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

        Activity

          People

            vhilshei Volker Hilsheimer
            luqiaochen Luqiao Chen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes