Merge pull request #5152 from chrchr-github/chr_Fix11189
Partial fix for #11189 checkLibraryNoReturn with std::function parameter
This commit is contained in:
commit
58dd92dd1b
|
@ -7775,7 +7775,7 @@ bool Tokenizer::isScopeNoReturn(const Token *endScopeToken, bool *unknown) const
|
|||
bool warn = true;
|
||||
if (Token::simpleMatch(endScopeToken->tokAt(-2), ") ; }")) {
|
||||
const Token * const ftok = endScopeToken->linkAt(-2)->previous();
|
||||
if (ftok && (ftok->type() || ftok->function())) // constructor call
|
||||
if (ftok && (ftok->type() || ftok->function() || ftok->variable())) // constructor call
|
||||
warn = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2652,12 +2652,20 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:5]: (error) Resource leak: file\n", errout.str());
|
||||
}
|
||||
|
||||
void configuration6() { // #11198
|
||||
check("void f() {}\n"
|
||||
void configuration6() {
|
||||
check("void f() {}\n" // #11198
|
||||
"void g() {\n"
|
||||
" f();\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(std::function<void()> cb) {\n" // #11189
|
||||
" cb();\n"
|
||||
"}\n"
|
||||
"void g(void (*cb)()) {\n"
|
||||
" cb();\n"
|
||||
"}\n", /*cpp*/ true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void ptrptr() {
|
||||
|
|
Loading…
Reference in New Issue