Bug 457719

Summary: Incorrect warning [-Wclazy-incorrect-emit]
Product: [Developer tools] clazy Reporter: Richard <richard.oehlinger>
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: REPORTED ---    
Severity: major CC: smartins
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Richard 2022-08-10 14:26:17 UTC
SUMMARY
Following code produces an incorrect emit warning:
Emitting inside constructor probably has no effect [-Wclazy-incorrect-emit]
When i change the connect to a pointer to method, the error doesn't occour.
***
class MyClass : public QObject
{
    Q_OBJECT
public:
    void func();
signals:
    void mySignal();
};


void MyClass::func()
{

    QNetworkReply* logout_reply = nullptr;
    QObject::connect(logout_reply, &QNetworkReply::finished, []
    {

    });
    emit mySignal();
}
****
By the way IncorrectEmit::hasEmitKeyboard looks like a mis-spelling.