Fixed ticket 216 (False positive: variable scope)
This commit is contained in:
parent
6c1af7e5e6
commit
afcaa30b51
|
@ -520,6 +520,7 @@ void CheckOther::CheckVariableScope()
|
|||
continue;
|
||||
|
||||
if ((tok1->str() == "return") ||
|
||||
(tok1->str() == "throw") ||
|
||||
(tok1->str() == "delete") ||
|
||||
(tok1->str() == "goto") ||
|
||||
(tok1->str() == "else"))
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue