From ff690abf8020bd9f70e8dceeb8153692a211f222 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Thu, 1 Sep 2011 07:10:11 -0400 Subject: [PATCH] better error message for #3064 (false negative: returning address of stack variable) --- lib/checkautovariables.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index 878bc57b7..0d844ab11 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -273,7 +273,9 @@ void CheckAutoVariables::errorAutoVariableAssignment(const Token *tok, bool inco void CheckAutoVariables::errorReturnAddressOfFunctionParameter(const Token *tok, const std::string &varname) { 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."); } //---------------------------------------------------------------------------