#8206 - Added a regression test

This commit is contained in:
orbitcowboy 2021-04-09 08:53:01 +02:00
parent 260eb4acac
commit b5719418ea
1 changed files with 8 additions and 0 deletions

View File

@ -3087,6 +3087,14 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
// #8206 - knownCondition always false
check("void f(int i)\n"
"{\n"
" if(i > 4)\n"
" for( int x = 0; i < 3; ++x){}\n" // <<
"}");
ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:4]: (style) Condition 'i<3' is always false\n", errout.str());
// Skip literals
check("void f() { if(true) {} }");
ASSERT_EQUALS("", errout.str());