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