Skip to content

Commit 07840dd

Browse files
committed
Add test case for FP reported in #10
The query already deals with the case where the condition is in an uninitialized template.
1 parent 819e9f9 commit 07840dd

File tree

1 file changed

+13
-0
lines changed
  • cpp/common/test/rules/nonbooleanifstmt

1 file changed

+13
-0
lines changed

cpp/common/test/rules/nonbooleanifstmt/test.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,16 @@ void test_boolean_conditions() {
4646
if (a) { // COMPLIANT - a has an explicit operator bool()
4747
}
4848
}
49+
50+
template <typename T> bool test_fp_reported_in_10a(T &p1) {
51+
if (p1.length() > 10) { // COMPLIANT
52+
return true;
53+
}
54+
return false;
55+
}
56+
57+
#include <string>
58+
void test_fp_reported_in_10b() {
59+
std::string s;
60+
test_fp_reported_in_10a(s);
61+
}

0 commit comments

Comments
 (0)