better error message for #3064 (false negative: returning address of stack variable)

This commit is contained in:
Robert Reif 2011-09-01 07:10:11 -04:00
parent e7dc765ece
commit ff690abf80
1 changed files with 3 additions and 1 deletions

View File

@ -273,7 +273,9 @@ void CheckAutoVariables::errorAutoVariableAssignment(const Token *tok, bool inco
void CheckAutoVariables::errorReturnAddressOfFunctionParameter(const Token *tok, const std::string &varname) void CheckAutoVariables::errorReturnAddressOfFunctionParameter(const Token *tok, const std::string &varname)
{ {
reportError(tok, Severity::error, "returnAddressOfFunctionParameter", reportError(tok, Severity::error, "returnAddressOfFunctionParameter",
"Return the address of function parameter '" + varname + "'"); "Return the address of function parameter '" + varname + "'\n"
"Address of the function parameter '" + varname + "' is invalid after the function exits. "
"Function parameters are created into the stack. When the function exits the stack is deleted.");
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------