Fixed #1515 (false positive: The function 'wxThreadInternal::SetExitCode' can be const)

This commit is contained in:
Robert Reif 2010-03-23 07:37:20 +01:00 committed by Daniel Marjamäki
parent 637a34bfd2
commit 9808a59cc1
2 changed files with 16 additions and 2 deletions

View File

@ -150,13 +150,14 @@ CheckClass::Var *CheckClass::getVarList(const Token *tok1, bool withClasses, boo
}
// std::string..
else if (withClasses && Token::Match(next, "std :: string %var% ;"))
else if (withClasses && Token::Match(next, "%type% :: %type% %var% ;"))
{
varname = next->strAt(3);
}
// Container..
else if (withClasses && Token::Match(next, "std :: %type% <"))
else if (withClasses && (Token::Match(next, "%type% :: %type% <") ||
Token::Match(next, "%type% <")))
{
while (next && next->str() != ">")
next = next->next();

View File

@ -93,6 +93,7 @@ private:
TEST_CASE(const6); // ticket #1491
TEST_CASE(const7);
TEST_CASE(const8); // ticket #1517
TEST_CASE(const9); // ticket #1515
TEST_CASE(constoperator); // operator< can often be const
TEST_CASE(constincdec); // increment/decrement => non-const
TEST_CASE(constReturnReference);
@ -2142,6 +2143,18 @@ private:
ASSERT_EQUALS("[test.cpp:4]: (style) The function 'A::strGetString' can be const\n", errout.str());
}
void const9()
{
// ticket #1515
checkConst("class wxThreadInternal {\n"
"public:\n"
" void SetExitCode(wxThread::ExitCode exitcode) { m_exitcode = exitcode; }\n"
"private:\n"
" wxThread::ExitCode m_exitcode;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
// increment/decrement => not const
void constincdec()
{