diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index df7aff593..891f99b44 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -7783,7 +7783,10 @@ void Tokenizer::simplifyComma() // Skip unhandled template specifiers.. if (Token::Match(tok, "%var% <")) { - tok->next()->findClosingBracket(tok); + Token* tok2; + tok->next()->findClosingBracket(tok2); + if (tok2) + tok = tok2; } // If token after the comma is a constant number, simplification is not required. diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 44681ba97..0e5bf900b 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -3064,7 +3064,7 @@ private: void varid33() { // ticket #2875 (segmentation fault) const std::string code("0; (a) < (a)"); - tokenizeDebugListing(code); + tokenizeDebugListing(code, true); ASSERT_EQUALS("", errout.str()); }