From 5d5e347418f617ed3e8a3123810d041940f4bee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 25 Dec 2013 22:08:53 +0100 Subject: [PATCH] AST: better handling of 'sizeof(void*)' --- lib/tokenlist.cpp | 2 ++ test/testtokenize.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index d07430400..1610a0744 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -531,6 +531,8 @@ static void compileMulDiv(Token *&tok, std::stack &op) compileDot(tok,op); while (tok) { if (Token::Match(tok, "[*/%]")) { + if (Token::Match(tok, "* [,)]")) + break; compileBinOp(tok, compileDot, op); } else break; } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 7ccde8236..d58d6424b 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -10065,6 +10065,7 @@ private: testAst("extern void f(const char *format, ...);"); // don't crash testAst("extern int for_each_commit_graft(int (*)(int*), void *);"); // don't crash testAst("for (;;) {}"); // don't crash + ASSERT_EQUALS("xsizeofvoid(=", testAst("x=sizeof(void*)")); } void asttemplate() const { // uninstantiated templates will have <,>,etc..