<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57520>57520</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `readability-convert-member-functions-to-static` false positive with Qt `slot` methods
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          firewave
      </td>
    </tr>
</table>

<pre>
    ```cpp
#include <QObject>

class TestDummy : public QObject {
Q_OBJECT

private slots:
    void construct();
};

#include <QtTest>

void TestDummy::construct()
{
    QCOMPARE(13, 13); // no warning with empty body
}

QTEST_MAIN(TestDummy)
```

`clang-tidy-14 -checks=readability-convert-member-functions-to-static testdummy.cpp -- -isystem /usr/include/x86_64-linux-gnu/qt5/QtTest -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore`

```
testdummy.cpp:12:17: error: method 'construct' can be made static [readability-convert-member-functions-to-static,-warnings-as-errors]
void TestDummy::construct()
                ^
```

The methods are called on a class object in the generated MOC:
```cpp
void TestDummy::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
    if (_c == QMetaObject::InvokeMetaMethod) {
        auto *_t = static_cast<TestDummy*>(_o);
        (void)_t;
        switch (_id) {
        case 0: _t->construct(); break;
        default: ;
        }
    }
    (void)_a;
}
```

I guess there's not much which can be done on the clang-tidy side here but I thought it might be worth reporting anyways since this should be a very common pattern in Qt applications.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVV2PqkgQ_TX4UsEgKMqDD466yWwyO-uu76SBUnsHaG53o9d_v6eRUWec3WQu0aahq-qc-iRTxXnuxcHllzeNF6y8YOGFkazzsi2YvGi5ec3-4dx60bo_7da8FMbQlo1dtVV1huCCmjYrZU69AnnTp4vsJn19-n293N7rN1oehWUypbIGype3hOuoZE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