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

error: no match for ‘operator==’ (operand types are ‘const QDomDocument::ParseResult’ and ‘const bool’)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 6.5.2
    • XML: DOM
    • None
    • Linux/Wayland

    Description

      I am trying to fix compilation with Qt 6.5.2 on Manjaro in this project:

      https://github.com/sailfishos/buteo-mtp/blob/10bbb024510dbe408812d06fc93eb98c443783a3/mts/platform/deviceinfo/unittests/deviceinfoprovider_test.cpp#L49

      And I am getting following error message:

      In file included from /usr/include/qt6/QtTest/qtesteventloop.h:8,
                       from /usr/include/qt6/QtTest/qsignalspy.h:11,
                       from /usr/include/qt6/QtTest/QtTest:10,
                       from deviceinfoprovider_test.h:35,
                       from deviceinfoprovider_test.cpp:35:
      /usr/include/qt6/QtTest/qtestcase.h: In instantiation of ‘bool QTest::qCompare(const T1&, const T2&, const char*, const char*, const char*, int) [with T1 = QDomDocument::ParseResult; T2 = bool]’:
      deviceinfoprovider_test.cpp:50:5:   required from here
      /usr/include/qt6/QtTest/qtestcase.h:585:34: error: no match foroperator==’ (operand types are ‘const QDomDocument::ParseResult’ and ‘const bool’)
        585 |         return compare_helper(t1 == t2, "Compared values are not the same",
            |                               ~~~^~~~~
      /usr/include/qt6/QtTest/qtestcase.h:585:34: note: candidate: ‘operator==(int, int)’ (built-in)
      /usr/include/qt6/QtTest/qtestcase.h:585:34: note:   no known conversion for argument 1 from ‘const QDomDocument::ParseResult’ to ‘int’
      In file included from /usr/include/qt6/QtCore/qcborvalue.h:9,
                       from /usr/include/qt6/QtCore/qcborarray.h:7,
                       from /usr/include/qt6/QtCore/QtCore:44,
                       from /usr/include/qt6/QtTest/QtTestDepends:3,
                       from /usr/include/qt6/QtTest/QtTest:3:
       

      I believe there is missing const in QDomDocument::ParseResult operator bool at

      https://github.com/qt/qtbase/blob/0f0ab90cf60a7169c365c8c9f46b7ccd379a10d1/src/xml/dom/qdom.h#L281

      I am not sure if this is feature of Qt or C++ compiler it self and I am not 100% sure that I understand correctly the error message.

      However, replacement of mentioned line of code like this solved issue for me:

      -    QCOMPARE(m_xmlDoc->setContent(m_xmlFile), true);
      +    QCOMPARE(m_xmlDoc->setContent(m_xmlFile).errorMessage.isEmpty(), true); 

       

      Attachments

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

        Activity

          People

            Eddy Edward Welbourne
            xmlich02 Jozef Mlich
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes