Fix 10784: False positive: returnDanglingLifetime using std::tie with variadic template parameters (#3805)
This commit is contained in:
parent
b5ed13c8bc
commit
20a5224d7e
|
@ -3021,6 +3021,8 @@ static std::vector<LifetimeToken> getLifetimeTokens(const Token* tok,
|
|||
{
|
||||
if (!tok)
|
||||
return std::vector<LifetimeToken> {};
|
||||
if (Token::simpleMatch(tok, "..."))
|
||||
return std::vector<LifetimeToken>{};
|
||||
const Variable *var = tok->variable();
|
||||
if (pred(tok))
|
||||
return {{tok, std::move(errorPath)}};
|
||||
|
|
|
@ -2955,6 +2955,13 @@ private:
|
|||
ASSERT_EQUALS(
|
||||
"[test.cpp:11] -> [test.cpp:10] -> [test.cpp:11]: (error) Non-local variable 'mMoreData.data1' will use pointer to local variable 'data'.\n",
|
||||
errout.str());
|
||||
|
||||
// #10784
|
||||
check("template <class... Ts>\n"
|
||||
"auto f(int i, Ts&... xs) {\n"
|
||||
" return std::tie(xs[i]...);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void danglingLifetimeFunction() {
|
||||
|
|
Loading…
Reference in New Issue