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

Ambiguous string comparison in QML Plugin Dumper

    XMLWordPrintable

Details

    • Linux/Wayland, Linux/X11
    • 40eaa9509b1c2e430b7617e1b42aa66214ad80df (qt/qtdeclarative/dev) 2a5b952a624abd2ea45192861f8f56479743aa8b (qt/qtdeclarative/6.0) 3dda59305053240d154cab3b35fbcbcc9cfa9042 (qt/qtdeclarative/6.1) 2426d3aec5 (qt/qtdeclarative/5.15)

    Description

      When compiled with clang, the module QmlPluginDump produces the following error:

      qtdeclarative/tools/qmlplugindump/main.cpp:118:44: error: use of overloaded operator '==' is ambiguous (with operand types 'const QString' and 'QHashedString')
       || versionInfo.pluginImportUri == ty.module()
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
      /home/twdragon/src/qt5/build/qtbase/include/QtCore/../../../../qtbase/src/corelib/text/qstring.h:806:31: note: candidate function
       friend Q_CORE_EXPORT bool operator==(const QString &s1, const QString &s2) noexcept;
       ^
      ../../include/QtQml/5.15.2/QtQml/private/../../../../../../../qtdeclarative/src/qml/qml/ftw/qhashedstring_p.h:212:21: note: candidate function (with reversed parameter order)
      bool QHashedString::operator==(const QHashedString &string) const
       ^
      ../../include/QtQml/5.15.2/QtQml/private/../../../../../../../qtdeclarative/src/qml/qml/ftw/qhashedstring_p.h:218:21: note: candidate function (with reversed parameter order)
      

      The workaround is to select the inherited type explicitly in file qtdeclarative/tools/qmlplugindump/main.cpp:

      static bool matchingImportUri(const QQmlType &ty, const QmlVersionInfo& versionInfo) {
       if (versionInfo.strict) {
       return (versionInfo.pluginImportUri == static_cast<QString>(ty.module())
       && (ty.majorVersion() == versionInfo.majorVersion || ty.majorVersion() == -1))
       || ty.module().isEmpty();
       }
       return ty.module().isEmpty()
       || versionInfo.pluginImportUri == static_cast<QString>(ty.module())
       || ty.module().startsWith(versionInfo.pluginImportUri + QLatin1Char('.'));
      }

      instead of:

      static bool matchingImportUri(const QQmlType &ty, const QmlVersionInfo& versionInfo) {
       if (versionInfo.strict)
      { return (versionInfo.pluginImportUri == ty.module() && (ty.majorVersion() == versionInfo.majorVersion || ty.majorVersion() == -1)) || ty.module().isEmpty(); }
      return ty.module().isEmpty()
      
      versionInfo.pluginImportUri == ty.module()   ty.module().startsWith(versionInfo.pluginImportUri + QLatin1Char('.'));
       }    

      Attachments

        For Gerrit Dashboard: QTBUG-89955
        # Subject Branch Project Status CR V

        Activity

          People

            max.goldstein Maximilian Goldstein
            twdragon Andrei Vukolov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes