diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 3ed6d5535..2810c3fc5 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -3021,6 +3021,8 @@ static std::vector getLifetimeTokens(const Token* tok, { if (!tok) return std::vector {}; + if (Token::simpleMatch(tok, "...")) + return std::vector{}; const Variable *var = tok->variable(); if (pred(tok)) return {{tok, std::move(errorPath)}}; diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index 5122e147b..f6c284bcd 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -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 \n" + "auto f(int i, Ts&... xs) {\n" + " return std::tie(xs[i]...);\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void danglingLifetimeFunction() {