Skip to content

Commit e7a2585

Browse files
authored
noExplicitConstructor - Verbose error message edit (#5260)
The goal is to use keywords like "converting constructor" and "implicit conversion" that will help users further study what this warning is about. I think that the old message provided no context to the uninitiated.
1 parent bfaa7c0 commit e7a2585

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/checkclass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ void CheckClass::noConstructorError(const Token *tok, const std::string &classna
10671067
void CheckClass::noExplicitConstructorError(const Token *tok, const std::string &classname, bool isStruct)
10681068
{
10691069
const std::string message(std::string(isStruct ? "Struct" : "Class") + " '$symbol' has a constructor with 1 argument that is not explicit.");
1070-
const std::string verbose(message + " Such constructors should in general be explicit for type safety reasons. Using the explicit keyword in the constructor means some mistakes when using the class can be avoided.");
1070+
const std::string verbose(message + " Such, so called \"Converting constructors\", should in general be explicit for type safety reasons as that prevents unintended implicit conversions.");
10711071
reportError(tok, Severity::style, "noExplicitConstructor", "$symbol:" + classname + '\n' + message + '\n' + verbose, CWE398, Certainty::normal);
10721072
}
10731073

0 commit comments

Comments
 (0)