Clang should warn when one condition trivially subsumes another condition #30245
Labels
bugzilla
Issues migrated from bugzilla
clang:diagnostics
New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Extended Description
Consider this test code:
bool f(int x) {
return x == 42 || x != 13;
}
bool g(int x) {
return x == 42 || x > 13;
}
Both of these contain trivially subsumed cases in an ||. I think Clang should be able to at least warn on these in ||s and &&s when the expressions are integral type comparisons that we can easily analyze.
The text was updated successfully, but these errors were encountered: