diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 535e42521..f7fa47e01 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -438,7 +438,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok) // Skip variadic types (Ticket #5774, #6059, #6172) if (Token::simpleMatch(tok, "...")) { if ((tok->previous()->isName() && !Token::Match(tok->tokAt(-2), "<|,|::")) || - (!tok->previous()->isName() && !Token::Match(tok->previous(), ">|&"))) + (!tok->previous()->isName() && !Token::Match(tok->previous(), ">|&|&&|*"))) return 0; // syntax error tok = tok->next(); if (!tok) diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index 906d7afce..7caafd6c6 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -5298,6 +5298,8 @@ private: ASSERT_EQUALS(2U, templateParameters("template::value), int>> void i(S s);")); ASSERT_EQUALS(2U, templateParameters("template> void e();")); ASSERT_EQUALS(3U, templateParameters("template > constexpr void f() {}")); // #11351 + ASSERT_EQUALS(3U, templateParameters("template > void f() {}")); + ASSERT_EQUALS(3U, templateParameters("template > void f() {}")); } // Helper function to unit test TemplateSimplifier::getTemplateNamePosition