-
Notifications
You must be signed in to change notification settings - Fork 16.5k
Open
Labels
Description
#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/QtCoretestdummy.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:
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.
Reactions are currently unavailable