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..