#6645 false negative: condition is always false. Add a regression test
This commit is contained in:
parent
24dd4c9c26
commit
c2f0828a61
|
@ -1911,6 +1911,15 @@ private:
|
||||||
|
|
||||||
check("void f2(int a, int b) { if(a!=b) if(a!=b) {}}");
|
check("void f2(int a, int b) { if(a!=b) if(a!=b) {}}");
|
||||||
ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (warning) Identical inner 'if' condition is always true.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (warning) Identical inner 'if' condition is always true.\n", errout.str());
|
||||||
|
|
||||||
|
// #6645 false negative: condition is always false
|
||||||
|
check("void f(bool a, bool b) {\n"
|
||||||
|
" if(a && b) {\n"
|
||||||
|
" if(a) {}\n"
|
||||||
|
" else {}\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (warning) Identical inner 'if' condition is always true.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void identicalConditionAfterEarlyExit() {
|
void identicalConditionAfterEarlyExit() {
|
||||||
|
|
Loading…
Reference in New Issue