From 9f3ecdde310a6f87fdedb2be2f3403c66c010a39 Mon Sep 17 00:00:00 2001 From: IOBYTE Date: Wed, 3 Apr 2019 00:02:38 -0400 Subject: [PATCH] Fixed #9076 (Template Simplifier : template < template T >) (#1777) This does not add support for template templates. It only skips the template template parameter. --- lib/templatesimplifier.cpp | 3 +++ test/testsimplifytemplate.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index cf3b70535..209563ed0 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -626,6 +626,9 @@ bool TemplateSimplifier::getTemplateDeclarations() } if (!Token::simpleMatch(tok, "template <")) continue; + // ignore template template parameter + if (tok->strAt(-1) == "<") + continue; // Some syntax checks, see #6865 if (!tok->tokAt(2)) syntaxError(tok->next()); diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index 3fc841a5f..e92517ff8 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -142,6 +142,7 @@ private: TEST_CASE(template102); // #9005 TEST_CASE(template103); TEST_CASE(template104); // #9021 + TEST_CASE(template105); // #9076 TEST_CASE(template_specialization_1); // #7868 - template specialization template struct S> {..}; TEST_CASE(template_specialization_2); // #7868 - template specialization template struct S> {..}; TEST_CASE(template_enum); // #6299 Syntax error in complex enum declaration (including template) @@ -2384,6 +2385,19 @@ private: ASSERT_EQUALS(exp, tok(code)); } + void template105() { // #9076 + const char code[] = "template