Sizeof calculation: Fixed FP for sizeof(int*[2])

This commit is contained in:
Daniel Marjamäki 2013-12-26 13:41:21 +01:00
parent 562387e3ff
commit 29e74222fb
2 changed files with 6 additions and 0 deletions

View File

@ -233,6 +233,9 @@ static bool isCalculation(const Token *op)
if (!op->astOperand2())
return false;
if (op->astOperand2()->str() == "[")
return false;
// type specification?
std::stack<const Token *> operands;
operands.push(op);

View File

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