diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 9c58fdd63..6e99e8398 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -3291,7 +3291,7 @@ private: } } - else if (Token::Match(&tok, "%var% (") && uvarFunctions.find(tok.str()) == uvarFunctions.end()) + if (Token::Match(&tok, "%var% (") && uvarFunctions.find(tok.str()) == uvarFunctions.end()) { if (Token::simpleMatch(&tok, "sizeof (")) return tok.next()->link(); diff --git a/test/testother.cpp b/test/testother.cpp index e623fff83..461a087df 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -2274,6 +2274,15 @@ private: " return x;\n" "}"); ASSERT_EQUALS("", errout.str()); + + checkUninitVar("void (*init)(char *str);\n" + "\n" + "char x() {\n" + " char cmd[10];\n" + " init(cmd);\n" + " return cmd[0];\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); }