MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / noExplicitConstructorError

Method noExplicitConstructorError

lib/checkclass.cpp:1165–1170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1163}
1164
1165void CheckClassImpl::noExplicitConstructorError(const Token *tok, const std::string &classname, bool isStruct)
1166{
1167 const std::string message(std::string(isStruct ? "Struct" : "Class") + " '$symbol' has a constructor with 1 argument that is not explicit.");
1168 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.");
1169 reportError(tok, Severity::style, "noExplicitConstructor", "$symbol:" + classname + '\n' + message + '\n' + verbose, CWE398, Certainty::normal);
1170}
1171
1172void CheckClassImpl::uninitVarError(const Token *tok, bool isprivate, FunctionType functionType, const std::string &classname, const std::string &varname, bool derived, bool inconclusive, bool noCtor)
1173{

Callers 1

getErrorMessagesMethod · 0.80

Calls 1

reportErrorFunction · 0.70

Tested by

no test coverage detected