#4871 "Uninitialized variable" when try/catch on an if branch. Regression test, issue got fixed since 1.69

This commit is contained in:
Alexander Mai 2015-07-25 19:02:20 +02:00
parent a36b544995
commit 6548f20d9a
1 changed files with 20 additions and 0 deletions

View File

@ -68,6 +68,7 @@ private:
TEST_CASE(uninitvar_funcptr); // #6404 TEST_CASE(uninitvar_funcptr); // #6404
TEST_CASE(uninitvar_operator); // #6680 TEST_CASE(uninitvar_operator); // #6680
TEST_CASE(uninitvar_ternaryexpression); // #4683 TEST_CASE(uninitvar_ternaryexpression); // #4683
TEST_CASE(trac_4871);
TEST_CASE(syntax_error); // Ticket #5073 TEST_CASE(syntax_error); // Ticket #5073
@ -3746,6 +3747,25 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void trac_4871() { // #4871
checkUninitVar("void pickup(int a) {\n"
"bool using_planner_action;\n"
"if (a) {\n"
" using_planner_action = false;\n"
"}\n"
"else {\n"
" try\n"
" {}\n"
" catch (std::exception &ex) {\n"
" return;\n"
" }\n"
" using_planner_action = true;\n"
"}\n"
"if (using_planner_action) {}\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void syntax_error() { // Ticket #5073 void syntax_error() { // Ticket #5073
// Nominal mode => No output // Nominal mode => No output
checkUninitVar("struct flex_array {};\n" checkUninitVar("struct flex_array {};\n"