parent
edc9cfba94
commit
96887c8130
|
@ -7529,7 +7529,7 @@ static void valueFlowFunctionReturn(TokenList *tokenlist, ErrorLogger *errorLogg
|
||||||
ProgramMemory programMemory;
|
ProgramMemory programMemory;
|
||||||
for (std::size_t i = 0; i < parvalues.size(); ++i) {
|
for (std::size_t i = 0; i < parvalues.size(); ++i) {
|
||||||
const Variable * const arg = function->getArgumentVar(i);
|
const Variable * const arg = function->getArgumentVar(i);
|
||||||
if (!arg || !Token::Match(arg->typeStartToken(), "%type% %name% ,|)")) {
|
if (!arg) {
|
||||||
if (tokenlist->getSettings()->debugwarnings)
|
if (tokenlist->getSettings()->debugwarnings)
|
||||||
bailout(tokenlist, errorLogger, tok, "function return; unhandled argument type");
|
bailout(tokenlist, errorLogger, tok, "function return; unhandled argument type");
|
||||||
programMemory.clear();
|
programMemory.clear();
|
||||||
|
|
|
@ -3707,6 +3707,11 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (error) Null pointer dereference: p\n"
|
ASSERT_EQUALS("[test.cpp:3]: (error) Null pointer dereference: p\n"
|
||||||
"[test.cpp:4]: (error) Null pointer dereference\n",
|
"[test.cpp:4]: (error) Null pointer dereference\n",
|
||||||
errout.str());
|
errout.str());
|
||||||
|
|
||||||
|
check("const char* g(long) { return nullptr; }\n" // #11561
|
||||||
|
"void f() { std::string s = g(0L); }\n");
|
||||||
|
ASSERT_EQUALS("[test.cpp:2]: (error) Null pointer dereference: g(0L)\n",
|
||||||
|
errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void nullpointerStdStream() {
|
void nullpointerStdStream() {
|
||||||
|
|
Loading…
Reference in New Issue