Skip to content

Commit f928218

Browse files
facchinmcmaglie
authored andcommitted
C++: mitigate matching error on generics containing an expression
backport of geany/geany@d40932c
1 parent fe0ba95 commit f928218

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

c.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,16 @@ static void skipToMatch (const char *const pair)
14261426
}
14271427
}
14281428
}
1429+
/* early out if matching "<>" and we encounter a ";" or "{" to mitigate
1430+
* match problems with C++ generics containing a static expression like
1431+
* foo<X<Y> bar;
1432+
* normally neither ";" nor "{" could appear inside "<>" anyway. */
1433+
else if (isLanguage (Lang_cpp) && begin == '<' &&
1434+
(c == ';' || c == '{'))
1435+
{
1436+
cppUngetc (c);
1437+
break;
1438+
}
14291439
}
14301440
if (c == EOF)
14311441
{

0 commit comments

Comments
 (0)