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

QCOMPARE can not handle nullptr

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.8.0 Alpha
    • 5.5.1, 5.6
    • Testing: qtestlib
    • None

    Description

      #include <QtTest>
      
      class TestClass : public QObject
      {
          Q_OBJECT
      public:
          TestClass(QObject* parent = {})
              : QObject(parent)
          {
      
          }
      
      private slots:
          void testNullPtr();
      };
      
      void TestClass::testNullPtr()
      {
          QObject* nullObject = nullptr;
          QCOMPARE(nullObject, nullptr);
      }
      
      QTEST_MAIN(TestClass)
      
      #include "tst_nullptr.moc"
      
      $ make
      makeobj[0]: Entering directory `/path/to/test'
      /usr/bin/clang++ -headerpad_max_install_names -stdlib=libc++ -Wl,-syslibroot,/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.7 -Wl,-rpath,/prefix/lib -o test.app/Contents/MacOS/test tst_nullptr.o   -F/prefix/lib -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework QtTest -framework Security -framework ApplicationServices -framework OpenGL -framework AGL 
      Undefined symbols for architecture x86_64:
        "bool QTest::qCompare<QObject*, std::nullptr_t>(QObject* const&, std::nullptr_t const&, char const*, char const*, char const*, int)", referenced from:
            TestClass::testNullPtr() in tst_nullptr.o
      ld: symbol(s) not found for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      make: *** [test.app/Contents/MacOS/test] Error 1
      makeobj[0]: Leaving directory `/path/to/test'
      

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            ske Steve
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes