diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index f906fbb91d9..72b4aee344e 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -454,8 +454,9 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok) if (level == 1) return numberOfParameters; level -= 2; - } else if (tok->str() == "," && level == 0) { - ++numberOfParameters; + } else if (tok->str() == ",") { + if (level == 0) + ++numberOfParameters; tok = tok->next(); continue; } diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index 73b851991a3..97ebef398c2 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -5318,6 +5318,7 @@ class TestSimplifyTemplate : public TestFixture { ASSERT_EQUALS(3U, templateParameters("template > void f() {}")); ASSERT_EQUALS(3U, templateParameters("template > void f() {}")); ASSERT_EQUALS(1U, templateParameters("S<4 < sizeof(uintptr_t)> x;")); + ASSERT_EQUALS(2U, templateParameters("template ::value>> void g() {}")); // #11915 } // Helper function to unit test TemplateSimplifier::getTemplateNamePosition