diff --git a/lib/checkfunctions.cpp b/lib/checkfunctions.cpp index 831103759..324b81581 100644 --- a/lib/checkfunctions.cpp +++ b/lib/checkfunctions.cpp @@ -338,7 +338,7 @@ static const Token *checkMissingReturnScope(const Token *tok, const Library &lib return nullptr; if (tok->str() == "goto" && !isForwardJump(tok)) return nullptr; - if (Token::Match(tok, "%name% (") && library.isnoreturn(tok)) + if (Token::Match(tok, "%name% (") && !library.isnotnoreturn(tok)) return nullptr; if (Token::Match(tok, "[;{}] %name% :")) return tok; diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index f38025a2f..f9a2ee003 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -1487,6 +1487,9 @@ private: // noreturn function check("int f(int x) { exit(0); }"); ASSERT_EQUALS("", errout.str()); + + check("int f(int x) { assert(0); }"); + ASSERT_EQUALS("", errout.str()); } // NRVO check void returnLocalStdMove1() {