From 2ed3b409370dc9771adba2a6b7072611b652073e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 4 Feb 2014 19:33:26 +0100 Subject: [PATCH] ast: fixed hang when checking bin-prot --- lib/tokenlist.cpp | 3 +++ test/testtokenize.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 789f37214..578ad9f0d 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -447,6 +447,9 @@ static void compileTerm(Token *& tok, std::stack &op) } else if (!Token::Match(tok->next(), "(|[") && !templatefunc) { op.push(tok); tok = tok->next(); + } else if (Token::Match(tok, "%type% ( {")) { + op.push(tok); + tok = tok->linkAt(2); } else { Token *name = tok; Token *par = templatefunc ? tok->linkAt(1)->next() : tok->next(); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index eaed38ccf..0c7709918 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -10157,6 +10157,9 @@ private: // ({..}) ASSERT_EQUALS("a{+d+ bc+", testAst("a+({b+c;})+d")); ASSERT_EQUALS("a{d*+ bc+", testAst("a+({b+c;})*d")); + ASSERT_EQUALS("xa(= bc( yd(= ef(", testAst("x=(int)(a({b(c);}));" + "y=(int)(d({e(f);}));")); + } void astbrackets() const { // []