Ticket #4296: Improve message text for operatorEq

This commit is contained in:
Alexander Mai 2014-03-28 20:29:33 +01:00
parent d6888410ec
commit 34d1f885a3
1 changed files with 3 additions and 1 deletions

View File

@ -1138,7 +1138,9 @@ void CheckClass::operatorEq()
void CheckClass::operatorEqReturnError(const Token *tok, const std::string &className)
{
reportError(tok, Severity::style, "operatorEq", "'" + className + "::operator=' should return '" + className + " &'.");
reportError(tok, Severity::style, "operatorEq", "'" + className + "::operator=' should return '" + className + " &'.\n"
"The "+className+"::operator= does not conform to standard C/C++ behaviour. To conform to standard C/C++ behaviour, return a reference to self (such as: '"+className+" &"+className+"::operator=(..) { .. return *this; }'. For safety reasons it might be better to not fix this message. If you think that safety is always more important than conformance then please ignore/suppress this message. For more details about this topic, see the book \"Effective C++\" by Scott Meyers."
);
}
//---------------------------------------------------------------------------