Skip to content

Commit b10988f

Browse files
committed
CPP: Fix the query.
1 parent 3f167a6 commit b10988f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

cpp/ql/src/Likely Bugs/Arithmetic/ComparisonPrecedence.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@
1414
import cpp
1515

1616
from ComparisonOperation co, ComparisonOperation chco
17-
where co.getAChild() = chco and not chco.isParenthesised()
17+
where
18+
co.getAChild() = chco and
19+
not chco.isParenthesised() and
20+
not co.isFromUninstantiatedTemplate(_)
1821
select co, "Check the comparison operator precedence."

cpp/ql/test/query-tests/Likely Bugs/Arithmetic/ComparisonPrecedence/ComparisonPrecedence.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
| template.cpp:4:7:4:15 | ... < ... | Check the comparison operator precedence. |
2-
| template.cpp:4:7:4:15 | ... < ... | Check the comparison operator precedence. |
3-
| template.cpp:10:7:10:15 | ... < ... | Check the comparison operator precedence. |
42
| test.cpp:42:6:42:14 | ... < ... | Check the comparison operator precedence. |
53
| test.cpp:43:6:43:14 | ... > ... | Check the comparison operator precedence. |
64
| test.cpp:44:6:44:16 | ... <= ... | Check the comparison operator precedence. |

cpp/ql/test/query-tests/Likely Bugs/Arithmetic/ComparisonPrecedence/template.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ void templateFunc1(T x, T y, T z) {
77

88
template <typename T>
99
void templateFunc2(T x, T y, T z) {
10-
if (x < y < z) {} // GOOD (used with an overloaded `operator<`) [FALSE POSITIVE]
10+
if (x < y < z) {} // GOOD (used with an overloaded `operator<`)
1111
if (x < y && y < z) {} // GOOD
1212
};
1313

0 commit comments

Comments
 (0)