Fixed ticket 216 (False positive: variable scope)

This commit is contained in:
Daniel Marjamäki 2009-03-24 20:59:56 +01:00
parent 6c1af7e5e6
commit afcaa30b51
2 changed files with 13 additions and 0 deletions

View File

@ -520,6 +520,7 @@ void CheckOther::CheckVariableScope()
continue;
if ((tok1->str() == "return") ||
(tok1->str() == "throw") ||
(tok1->str() == "delete") ||
(tok1->str() == "goto") ||
(tok1->str() == "else"))

View File

@ -52,6 +52,7 @@ private:
TEST_CASE(returnLocalVariable1);
TEST_CASE(varScope1);
TEST_CASE(varScope2);
}
void check(const char code[])
@ -314,6 +315,17 @@ private:
"}\n");
ASSERT_EQUALS(std::string(""), errout.str());
}
void varScope2()
{
varScope("int foo()\n"
"{\n"
" Error e;\n"
" e.SetValue(12);\n"
" throw e;\n"
"}\n");
ASSERT_EQUALS(std::string(""), errout.str());
}
};
REGISTER_TEST(TestOther)