Bug 410655 - Suggests to use Q_ENUM when you can't use it
Summary: Suggests to use Q_ENUM when you can't use it
Status: REPORTED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Unassigned bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-06 15:03 UTC by Albert Astals Cid
Modified: 2021-01-10 13:47 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 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