#8196: Added a regression test

This commit is contained in:
orbitcowboy 2021-08-05 08:07:03 +02:00
parent 27a4df06d2
commit 1f411498b6
1 changed files with 7 additions and 0 deletions

View File

@ -2952,6 +2952,13 @@ private:
void alwaysTrue() {
check("void f(const struct S *s) {\n" //#8196
" int x1 = s->x;\n"
" int x2 = s->x;\n"
" if (x1 == 10 && x2 == 10) {}\n" // <<
"}");
ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:4]: (style) Condition 'x2==10' is always true\n", errout.str());
check("void f ()\n"// #8220
"{\n"
" int a;\n"