Fixed #1803 (False positive: unused variable: this)

This commit is contained in:
Daniel Marjamäki 2010-07-07 08:39:18 +02:00
parent a107cd1b59
commit 2bb07a55bd
2 changed files with 14 additions and 1 deletions

View File

@ -1128,7 +1128,7 @@ void CheckOther::functionVariableUsage()
if (tok->str() == "const") if (tok->str() == "const")
tok = tok->next(); tok = tok->next();
if (tok->str() != "return") if (tok->str() != "return" && tok->str() != "throw")
{ {
Variables::VariableType type; Variables::VariableType type;

View File

@ -69,6 +69,7 @@ private:
TEST_CASE(localvar21); // ticket #1807 TEST_CASE(localvar21); // ticket #1807
TEST_CASE(localvar22); // ticket #1811 TEST_CASE(localvar22); // ticket #1811
TEST_CASE(localvar23); // ticket #1808 TEST_CASE(localvar23); // ticket #1808
TEST_CASE(localvar24); // ticket #1803
TEST_CASE(localvaralias1); TEST_CASE(localvaralias1);
TEST_CASE(localvaralias2); // ticket #1637 TEST_CASE(localvaralias2); // ticket #1637
TEST_CASE(localvaralias3); // ticket #1639 TEST_CASE(localvaralias3); // ticket #1639
@ -1216,6 +1217,18 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void localvar24() // ticket #1803
{
functionVariableUsage("class MyException\n"
"{\n"
" virtual void raise() const\n"
" {\n"
" throw *this;\n"
" }\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void localvaralias1() void localvaralias1()
{ {
functionVariableUsage("void foo()\n" functionVariableUsage("void foo()\n"