Bug 410655

Summary: Suggests to use Q_ENUM when you can't use it
Product: [Developer tools] clazy Reporter: Albert Astals Cid <aacid>
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: REPORTED ---    
Severity: wishlist CC: smartins
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Albert Astals Cid 2019-08-06 15:03:26 UTC
clazy 1.5

With this sample code clazy will say


#include <QObject>

enum class Status
{
    U,
    A,
    P,
    R
};
Q_ENUMS(Status);

int main(int argc, char **argv)
{
}

main.cpp:11:1: warning: Use Q_ENUM instead of Q_ENUMS [-Wclazy-qenums]
Q_ENUMS(Status);

but you can't use Q_ENUM in this situation since Q_ENUM doesn't work outside of a QObject
Comment 1 Albert Astals Cid 2019-08-07 20:48:18 UTC
On the other hand since

Q_ENUMS(Status);

there actually does nothing, i guess what it should say is

"your code is terrible, remove that Q_ENUMS or move it inside a QObject"

:D