diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 6a82bdb15..535e42521 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() && tok->strAt(-1) != ">")) + (!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 a995c8a48..418dad3e5 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -5297,6 +5297,7 @@ private: ASSERT_EQUALS(4U, templateParameters("template...Foo,int,template>>,int> x;")); 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 } // Helper function to unit test TemplateSimplifier::getTemplateNamePosition