#3382 (Clarify error message 'invalid deallocation')

This commit is contained in:
Daniel Marjamäki 2011-12-30 10:32:55 +01:00
parent 2ae48c7aef
commit 6a0c463ebd
2 changed files with 7 additions and 2 deletions

View File

@ -339,7 +339,12 @@ void CheckAutoVariables::errorReturnTempReference(const Token *tok)
void CheckAutoVariables::errorInvalidDeallocation(const Token *tok)
{
reportError(tok, Severity::error, "autovarInvalidDeallocation", "Invalid deallocation");
reportError(tok,
Severity::error,
"autovarInvalidDeallocation",
"Deallocating auto-variable is invalid\n"
"Deallocating an auto-variable is invalid. You should only free memory "
"that has been allocated dynamically.");
}

View File

@ -297,7 +297,7 @@ private:
"char tmp[256];\n"
"free (tmp);\n"
"}\n");
ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Invalid deallocation\n"), errout.str());
ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Deallocating auto-variable is invalid\n"), errout.str());
check("void f()\n"
"{\n"