From 1e708e10d072666b09e58d3530c85af5f381697a Mon Sep 17 00:00:00 2001 From: PKEuS Date: Thu, 26 Apr 2012 10:35:40 +0200 Subject: [PATCH] Fixed #2875 --- lib/tokenize.cpp | 5 ++++- test/testtokenize.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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()); }