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

Method dereferenceErasedError

lib/checkstl.cpp:382–398  ·  view source on GitHub ↗

Error message used when dereferencing an iterator that has been erased..

Source from the content-addressed store, hash-verified

380
381// Error message used when dereferencing an iterator that has been erased..
382void CheckStlImpl::dereferenceErasedError(const Token *erased, const Token* deref, const std::string &itername, bool inconclusive)
383{
384 if (erased) {
385 std::list<const Token*> callstack = { deref, erased };
386 reportError(callstack, Severity::error, "eraseDereference",
387 "$symbol:" + itername + "\n"
388 "Iterator '$symbol' used after element has been erased.\n"
389 "The iterator '$symbol' is invalid after the element it pointed to has been erased. "
390 "Dereferencing or comparing it with another iterator is invalid operation.", CWE664, inconclusive ? Certainty::inconclusive : Certainty::normal);
391 } else {
392 reportError(deref, Severity::error, "eraseDereference",
393 "$symbol:" + itername + "\n"
394 "Invalid iterator '$symbol' used.\n"
395 "The iterator '$symbol' is invalid before being assigned. "
396 "Dereferencing or comparing it with another iterator is invalid operation.", CWE664, inconclusive ? Certainty::inconclusive : Certainty::normal);
397 }
398}
399
400static const Token *skipMembers(const Token *tok)
401{

Callers 1

getErrorMessagesMethod · 0.80

Calls 1

reportErrorFunction · 0.70

Tested by

no test coverage detected