diff --git a/lib/executionpath.cpp b/lib/executionpath.cpp index 0e9411c5d..5437c5e58 100644 --- a/lib/executionpath.cpp +++ b/lib/executionpath.cpp @@ -140,7 +140,7 @@ static const Token *checkExecutionPaths_(const Token *tok, std::liststr() != "{" && tok->str() != ";") tok = tok->next(); diff --git a/test/testother.cpp b/test/testother.cpp index d2c6f164d..7ee950c3e 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1683,6 +1683,19 @@ private: " } = { 0, 0 };\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + checkUninitVar("void f()\n" + "{\n" + " int i;\n" + " {\n" + " union ab {\n" + " int a,b;\n" + " }\n" + " i = 0;\n" + " }\n" + " return i;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } // enum..