File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -965,7 +965,7 @@ const Token * Token::findClosingBracket() const
965965 depth -= 2 ;
966966 }
967967 // save named template parameter
968- else if (templateParameter && depth == 1 && closing-> str () == " , " &&
968+ else if (templateParameter && depth == 1 && Token::Match (closing, " [,=] " ) &&
969969 closing->previous ()->isName () && !Match (closing->previous (), " class|typename|." ))
970970 templateParameters.insert (closing->strAt (-1 ));
971971 }
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ class TestToken : public TestFixture {
108108 TEST_CASE (canFindMatchingBracketsWithTooManyOpening);
109109 TEST_CASE (findClosingBracket);
110110 TEST_CASE (findClosingBracket2);
111+ TEST_CASE (findClosingBracket3);
111112
112113 TEST_CASE (expressionString);
113114
@@ -1157,6 +1158,14 @@ class TestToken : public TestFixture {
11571158 ASSERT (t && Token::simpleMatch (t->findClosingBracket (), " >" ));
11581159 }
11591160
1161+ void findClosingBracket3 () {
1162+ const SimpleTokenizer var (*this , // #12789
1163+ " template <size_t I = 0, typename... ArgsT, std::enable_if_t<I < sizeof...(ArgsT)>* = nullptr>\n "
1164+ " void f();\n " );
1165+ const Token* const t = Token::findsimplematch (var.tokens (), " <" );
1166+ ASSERT (t && Token::simpleMatch (t->findClosingBracket (), " >" ));
1167+ }
1168+
11601169 void expressionString () {
11611170 const SimpleTokenizer var1 (*this , " void f() { *((unsigned long long *)x) = 0; }" );
11621171 const Token *const tok1 = Token::findsimplematch (var1.tokens (), " *" );
You can’t perform that action at this time.
0 commit comments