diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index 47bbe3717..d15209b9f 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -348,7 +348,7 @@ private: void parserhs(const Token *tok2, std::list &checks) const { // check variable usages in rhs/index while (NULL != (tok2 = tok2->next())) { - if (Token::Match(tok2, "[;)=?]")) + if (Token::Match(tok2, "[;)=]")) break; if (Token::Match(tok2, "%var% (")) break; diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 865944d43..d2ac22d7d 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -778,11 +778,9 @@ private: checkUninitVar("static void foo(int v)\n" "{\n" " int x;\n" - " if (v > 0)\n" - " v = func(&x);\n" " x = v <= 0 ? -1 : x;\n" "}\n"); - ASSERT_EQUALS("", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: x\n", errout.str()); checkUninitVar("void foo()\n" "{\n"