parent
78182d4773
commit
00733893e0
|
@ -395,11 +395,7 @@ static const Token *checkMissingReturnScope(const Token *tok, const Library &lib
|
|||
if (tok->str() == "goto" && !isForwardJump(tok))
|
||||
return nullptr;
|
||||
if (Token::Match(tok, "%name% (") && !library.isnotnoreturn(tok)) {
|
||||
const Token *start = tok;
|
||||
while (Token::Match(start->tokAt(-2), "%name% :: %name%"))
|
||||
start = start->tokAt(-2);
|
||||
if (Token::Match(start->previous(), "[;{}] %name% ::|("))
|
||||
return nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
if (Token::Match(tok, "[;{}] %name% :"))
|
||||
return tok;
|
||||
|
|
|
@ -1741,6 +1741,16 @@ private:
|
|||
|
||||
check("template<class T> typename std::enable_if<std::is_same<T, int>{}>::type f(T) {}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct S {\n"
|
||||
" [[noreturn]] void f();\n"
|
||||
" int g() { this->f(); }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct S { [[noreturn]] void f(); };\n"
|
||||
"int g(S& s) { s.f(); }\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
// NRVO check
|
||||
|
|
Loading…
Reference in New Issue