C++: Add testcase demonstrating false positive

This commit is contained in:
Mathias Vorreiter Pedersen
2020-01-07 13:18:38 +01:00
parent bdd0589223
commit faa9d83567
2 changed files with 8 additions and 0 deletions

View File

@@ -14,3 +14,4 @@
| test.cpp:84:7:84:11 | ... = ... | Use of '=' where '==' may have been intended. |
| test.cpp:92:17:92:22 | ... = ... | Use of '=' where '==' may have been intended. |
| test.cpp:113:6:113:10 | ... = ... | Use of '=' where '==' may have been intended. |
| test.cpp:124:6:124:15 | ... = ... | Use of '=' where '==' may have been intended. |

View File

@@ -116,4 +116,11 @@ void h() {
void f() {
h<int>();
}
void f2() {
const char* sz = "abc";
if(sz = "def") { // GOOD [FALSE POSITIVE]: a == comparison with a string literal is probably not the intent here
}
}