From 6548f20d9a590402a37d09c5c208b0302f90fb62 Mon Sep 17 00:00:00 2001 From: Alexander Mai Date: Sat, 25 Jul 2015 19:02:20 +0200 Subject: [PATCH] #4871 "Uninitialized variable" when try/catch on an if branch. Regression test, issue got fixed since 1.69 --- test/testuninitvar.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 2adf70115..602802606 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -68,6 +68,7 @@ private: TEST_CASE(uninitvar_funcptr); // #6404 TEST_CASE(uninitvar_operator); // #6680 TEST_CASE(uninitvar_ternaryexpression); // #4683 + TEST_CASE(trac_4871); TEST_CASE(syntax_error); // Ticket #5073 @@ -3746,6 +3747,25 @@ private: 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 // Nominal mode => No output checkUninitVar("struct flex_array {};\n"