-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
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 analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature
Description
We had this = vs. == bug in Chromium recently:
int f(int);
int g(int a) {
a == f(a) > 1 ? 1 : f(a);
// stuff
}In most cases, Clang would catch a = vs == bug with -Wunused-comparison, but in this case the unintentional comparison became an operand to the ternary operator, and no warning fired.
Perhaps there should be warning for the general case of "chained comparisons" that would catch the above as well as code like:
void h(int a, int b, int c) {
if (a > b > c) {
// stuff...
}
}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 analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature