diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 1abaaa1ea60..8b361110188 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -2099,7 +2099,7 @@ void TemplateSimplifier::expandTemplate( Token * const beforeTypeToken = mTokenList.back(); bool pointerType = false; const bool isVariadicTemplateArg = templateDeclaration.isVariadic() && itype + 1 == typeParametersInDeclaration.size(); - if (isVariadicTemplateArg && mTypesUsedInTemplateInstantiation.size() > 1 && !Token::simpleMatch(tok3->next(), "...")) + if (isVariadicTemplateArg && mTypesUsedInTemplateInstantiation.size() > 1 && !Token::Match(tok3->next(), "...|<")) continue; if (isVariadicTemplateArg && Token::Match(tok3, "%name% ... %name%")) tok3 = tok3->tokAt(2); diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index 38f2360d644..db64ae2b953 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -6334,6 +6334,20 @@ class TestSimplifyTemplate : public TestFixture { "} " "} ;"; ASSERT_EQUALS(expected, tok(code)); + + const char code2[] = "template \n" // #13929 + "struct S {};\n" + "template typename C = S>\n" + "struct A {\n" + " using x = C;\n" + "};\n" + "A a;\n"; + const char expected2[] = "template < typename T > " + "struct S { } ; " + "struct A ; " + "A a ; " + "struct A { } ;"; + ASSERT_EQUALS(expected2, tok(code2)); } void template_variable_1() {