File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -965,7 +965,7 @@ const Token * Token::findClosingBracket() const
965
965
depth -= 2 ;
966
966
}
967
967
// save named template parameter
968
- else if (templateParameter && depth == 1 && closing-> str () == " , " &&
968
+ else if (templateParameter && depth == 1 && Token::Match (closing, " [,=] " ) &&
969
969
closing->previous ()->isName () && !Match (closing->previous (), " class|typename|." ))
970
970
templateParameters.insert (closing->strAt (-1 ));
971
971
}
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ class TestToken : public TestFixture {
108
108
TEST_CASE (canFindMatchingBracketsWithTooManyOpening);
109
109
TEST_CASE (findClosingBracket);
110
110
TEST_CASE (findClosingBracket2);
111
+ TEST_CASE (findClosingBracket3);
111
112
112
113
TEST_CASE (expressionString);
113
114
@@ -1157,6 +1158,14 @@ class TestToken : public TestFixture {
1157
1158
ASSERT (t && Token::simpleMatch (t->findClosingBracket (), " >" ));
1158
1159
}
1159
1160
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
+
1160
1169
void expressionString () {
1161
1170
const SimpleTokenizer var1 (*this , " void f() { *((unsigned long long *)x) = 0; }" );
1162
1171
const Token *const tok1 = Token::findsimplematch (var1.tokens (), " *" );
You can’t perform that action at this time.
0 commit comments