From f928218c753e54968289a73285bf7c4345a8d553 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Tue, 23 Feb 2016 12:58:40 +0100 Subject: [PATCH 13/19] C++: mitigate matching error on generics containing an expression backport of https://github.com/geany/geany/commit/d40932ce4d05e57573a6d6c8f89f4aea8c42d4f3 --- c.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/c.c b/c.c index 386af29..1386ddd 100644 --- a/c.c +++ b/c.c @@ -1426,6 +1426,16 @@ static void skipToMatch (const char *const pair) } } } + /* early out if matching "<>" and we encounter a ";" or "{" to mitigate + * match problems with C++ generics containing a static expression like + * foo bar; + * normally neither ";" nor "{" could appear inside "<>" anyway. */ + else if (isLanguage (Lang_cpp) && begin == '<' && + (c == ';' || c == '{')) + { + cppUngetc (c); + break; + } } if (c == EOF) { -- 2.11.0