File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
src/Likely Bugs/Arithmetic
test/query-tests/Likely Bugs/Arithmetic/BadAdditionOverflowCheck Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,9 @@ predicate pointlessSelfComparison(ComparisonOperation cmp) {
29
29
not exists ( lhs .getQualifier ( ) ) and // Avoid structure fields
30
30
not exists ( rhs .getQualifier ( ) ) and // Avoid structure fields
31
31
not convertedExprMightOverflow ( lhs ) and
32
- not convertedExprMightOverflow ( rhs )
32
+ not convertedExprMightOverflow ( rhs ) and
33
+ // Don't warn if the comparison is part of a template argument.
34
+ not any ( ClassTemplateInstantiation inst ) .getATemplateArgument ( ) = cmp .getParent * ( )
33
35
)
34
36
}
35
37
Original file line number Diff line number Diff line change 1
1
| templates.cpp:17:5:17:25 | ... < ... | Self comparison. |
2
- | templates.cpp:31:20:31:41 | ... <= ... | Self comparison. |
3
2
| test.cpp:13:11:13:21 | ... == ... | Self comparison. |
4
3
| test.cpp:79:11:79:32 | ... == ... | Self comparison. |
5
4
| test.cpp:83:10:83:15 | ... == ... | Self comparison. |
You can’t perform that action at this time.
0 commit comments