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) {
2929 not exists ( lhs .getQualifier ( ) ) and // Avoid structure fields
3030 not exists ( rhs .getQualifier ( ) ) and // Avoid structure fields
3131 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 * ( )
3335 )
3436}
3537
Original file line number Diff line number Diff line change 11| templates.cpp:17:5:17:25 | ... < ... | Self comparison. |
2- | templates.cpp:31:20:31:41 | ... <= ... | Self comparison. |
32| test.cpp:13:11:13:21 | ... == ... | Self comparison. |
43| test.cpp:79:11:79:32 | ... == ... | Self comparison. |
54| test.cpp:83:10:83:15 | ... == ... | Self comparison. |
You can’t perform that action at this time.
0 commit comments