AST: fix handling of sizeof. ticket #6515
This commit is contained in:
parent
fd4d4bba33
commit
e251a99817
|
@ -521,6 +521,9 @@ static void compileTerm(Token *&tok, AST_state& state)
|
|||
if (tok->str() == "return") {
|
||||
compileUnaryOp(tok, state, compileExpression);
|
||||
state.op.pop();
|
||||
} else if (Token::Match(tok, "sizeof !!(")) {
|
||||
compileUnaryOp(tok, state, compileExpression);
|
||||
state.op.pop();
|
||||
} else if (!state.cpp || !Token::Match(tok, "new|delete %name%|*|&|::|(|[")) {
|
||||
while (tok->next() && tok->next()->isName())
|
||||
tok = tok->next();
|
||||
|
|
|
@ -8443,6 +8443,9 @@ private:
|
|||
ASSERT_EQUALS("a-1+", testAst("-a+1"));
|
||||
ASSERT_EQUALS("ab++-c-", testAst("a-b++-c"));
|
||||
|
||||
// sizeof
|
||||
ASSERT_EQUALS("ab.sizeof", testAst("sizeof a.b"));
|
||||
|
||||
// assignment operators
|
||||
ASSERT_EQUALS("ab>>=", testAst("a>>=b;"));
|
||||
ASSERT_EQUALS("ab<<=", testAst("a<<=b;"));
|
||||
|
|
Loading…
Reference in New Issue