* Fix #11171 FP missing return statement when std::enable_if_t is used * Add check
This commit is contained in:
parent
8275f07692
commit
f274d499a1
|
@ -310,6 +310,8 @@ void CheckFunctions::checkMissingReturn()
|
|||
continue;
|
||||
if (Token::Match(function->retDef, "%name% (") && function->retDef->isUpperCaseName())
|
||||
continue;
|
||||
if (mTokenizer->isCPP() && Token::Match(function->retDef, "std :: enable_if|enable_if_t"))
|
||||
continue;
|
||||
if (Function::returnsVoid(function, true))
|
||||
continue;
|
||||
const Token *errorToken = checkMissingReturnScope(scope->bodyEnd, mSettings->library);
|
||||
|
|
|
@ -1725,6 +1725,9 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:2]: (error) Found a exit path from function with non-void return type that has missing return statement\n"
|
||||
"[test.cpp:10]: (error) Found a exit path from function with non-void return type that has missing return statement\n",
|
||||
errout.str());
|
||||
|
||||
check("std::enable_if_t<sizeof(uint64_t) == 8> f() {}"); // #11171
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
// NRVO check
|
||||
|
|
Loading…
Reference in New Issue