diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index c59fdf288f7..d28b350ea8b 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -439,7 +439,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/testtokenize.cpp b/test/testtokenize.cpp index d5c770169e4..2edc79ab655 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -4697,6 +4697,23 @@ class TestTokenizer : public TestFixture { tokenizeAndStringify(code)); ASSERT_EQUALS("", errout_str()); } + { + const char code[] = "namespace N {\n" // #15192 + " template \n" + " struct S {};\n" + "}\n" + "template >\n" + "void f() {}\n"; + ASSERT_EQUALS("namespace N {\n" + "template < typename ... Ts >\n" + "struct S { } ;\n" + "}\n" + "template < typename ... Ts , typename = N :: S < decltype ( Ts ( ) ) ... > >\n" + "void f ( ) { }", + tokenizeAndStringify(code)); + ASSERT_EQUALS("", errout_str()); + } + } void cpp03template1() {