Skip to content

Commit 868ba25

Browse files
committed
C++: Establish that PointlessComparison.ql and PointlessSelfComparison.ql don't overlap (at least in the main case).
1 parent 43c6106 commit 868ba25

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@ int extreme_values(void)
4343
if (y >> 1 >= 0x7FFFFFFFFFFF) {} // $ Alert[cpp/constant-comparison] // always true
4444
if (y >> 1 >= 0xFFFFFFFFFFF) {} // $ Alert[cpp/constant-comparison] // always true
4545
}
46+
47+
// Test for overlap between PointlessComparison and PointlessSelfComparison
48+
// (PointlessComparison should *not* report this)
49+
bool selfCmp1(int x) {
50+
return (x == (int)x);
51+
}

0 commit comments

Comments
 (0)