AST: better handling of 'sizeof(void*)'

This commit is contained in:
Daniel Marjamäki 2013-12-25 22:08:53 +01:00
parent a15561d7eb
commit 5d5e347418
2 changed files with 3 additions and 0 deletions

View File

@ -531,6 +531,8 @@ static void compileMulDiv(Token *&tok, std::stack<Token*> &op)
compileDot(tok,op);
while (tok) {
if (Token::Match(tok, "[*/%]")) {
if (Token::Match(tok, "* [,)]"))
break;
compileBinOp(tok, compileDot, op);
} else break;
}

View File

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