- Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Description
clang should diagnose cases where comparison operators (< or >) are used instead of shift operators (<< or >>) in enumerator initializers. This is a common mistake that often occurs when defining bit flags or option enums.
For example:
enum E { kOptionOne = 1ull << 0, // correct kOptionTwo = 1ull < 1, // oops! kOptionThree = 1ull < 2, // oops! }; Although these are valid C/C++ expressions, they are very likely to be errors in this context.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer