Calculation in sizeof: Fixed FP for sizeof(Fred**)

This commit is contained in:
Daniel Marjamäki 2013-12-26 13:52:58 +01:00
parent 29e74222fb
commit 742a6935ea
2 changed files with 5 additions and 0 deletions

View File

@ -248,6 +248,8 @@ static bool isCalculation(const Token *op)
operands.push(item->astOperand1());
if (item->astOperand2())
operands.push(item->astOperand2());
else if (Token::Match(item, "*|&"))
return false;
}
// type specification => return false

View File

@ -100,6 +100,9 @@ private:
check("sizeof(int*[2])");
ASSERT_EQUALS("", errout.str());
check("sizeof(Fred**)");
ASSERT_EQUALS("", errout.str());
check("sizeof(foo++)");
ASSERT_EQUALS("[test.cpp:1]: (warning) Found calculation inside sizeof().\n", errout.str());