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

SCARY QDebug::toString() terrifies tests that compare Microsoft::WRL::ComPtr

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.0 Beta3, 6.9.0 FF
    • 6.8
    • Core: Other
    • None
    • Windows
    • f0ddab530 (dev), 5f38480c2 (6.8), a0bd57059 (dev), 6cd6c3d6d (dev), b64e918c8 (6.8)

    Description

      https://codereview.qt-project.org/c/qt/qtbase/+/577519 has a side-effect that QCOMPARE does not compile when called with Microsoft::WRL::ComPtr

          const Microsoft::WRL::ComPtr<IUnknown> stub;
          const Microsoft::WRL::ComPtr<IUnknown> recovered;
      
          QCOMPARE(recovered, stub);
      

      now fails with

      K:\qt\qt6\qtbase\src\corelib\io\qdebug.h(250):error C2664: 'QByteArray QDebug::toBytesImpl(QDebug::StreamTypeErased,const void *)': cannot convert argument 2 from 'const Microsoft::WRL::Details::ComPtrRef<const Microsoft::WRL::ComPtr<IUnknown>>' to 'const void *'
      K:/qt/qt6/qtbase/src/corelib/io/qdebug.h(250): note: Ambiguous user-defined-conversion
      K:/qt/qt6/qtbase/src/corelib/io/qdebug.h(239): note: see declaration of 'QDebug::toBytesImpl'
      K:/qt/qt6/qtbase/src/corelib/io/qdebug.h(250): note: while trying to match the argument list '(overloaded-function, const Microsoft::WRL::Details::ComPtrRef<const Microsoft::WRL::ComPtr<IUnknown>>)'
      K:/qt/qt6/qtbase/src/corelib/io/qdebug.h(250): note: the template instantiation context (the oldest one first) is
      K:\qt\qt6\qtactiveqt\tests\auto\conversion\tst_conversion.cpp(362): note: see reference to function template instantiation 'bool QTest::qCompare<Microsoft::WRL::ComPtr<IUnknown>,Microsoft::WRL::ComPtr<IUnknown>>(const T1 &,const T2 &,const char *,const char *,const char *,int)' being compiled
               with
               [
                   T1=Microsoft::WRL::ComPtr<IUnknown>,
                   T2=Microsoft::WRL::ComPtr<IUnknown>
               ]
      K:/qt/qt6/qtbase/src/testlib/qtestcase.h(622): note: see reference to function template instantiation 'const char *QTest::Internal::genericToString<D1>(const void *)' being compiled
      K:/qt/qt6/qtbase/src/testlib/qtestcase.h(355): note: see reference to function template instantiation 'char *QTest::toString<D1>(const T &)' being compiled
      

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            johanseg Jøger Hansegård
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: