Bug 457719 - Incorrect warning [-Wclazy-incorrect-emit]
Summary: Incorrect warning [-Wclazy-incorrect-emit]
Status: REPORTED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: Unassigned bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-10 14:26 UTC by Richard
Modified: 2022-08-10 14:26 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.