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

QMetaObject::invokeMethod gives no warning when using incorrect return type with Q_RETURN_ARG

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2, 6.2.0
    • Fix Version/s: None
    • Component/s: Core: Object Model
    • Labels:
      None

      Description

      If you use the wrong type for Q_ARG, you will get a list of candidates:

      14:27:14: Starting C:\dev\temp\quick-cpp-test-Desktop_Qt_6_2_0_MSVC2019_64bit-Debug\Stuff.exe ...
      ********* Start testing of Stuff *********
      Config: Using QtTest library 6.2.0, Qt 6.2.0 (x86_64-little_endian-llp64 shared (dynamic) debug build; by MSVC 2019), windows 10
      PASS   : Stuff::initTestCase()
      QWARN  : Stuff::test_case1() QMetaObject::invokeMethod: No such method WorldMap_QMLTYPE_0::worldMapTilePosToScenePos(QPointF)
      Candidates are:
          worldMapTilePosToScenePos(QVariant)
      FAIL!  : Stuff::test_case1() Failed to call worldMapTilePosToScenePos on chooseDestinationWorldMap
      C:\dev\temp\quick-cpp-test\tst_stuff.cpp(47) : failure location
      PASS   : Stuff::cleanupTestCase()
      Totals: 2 passed, 1 failed, 0 skipped, 0 blacklisted, 122ms
      ********* Finished testing of Stuff *********
      14:27:14: C:\dev\temp\quick-cpp-test-Desktop_Qt_6_2_0_MSVC2019_64bit-Debug\Stuff.exe exited with code 1
      

      If you make the same mistake with the return type, you get nothing besides a false return value.

      The list of candidates should also show the return type, and there should be a warning when only the return type is wrong.

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes