Sizeof calculation: Fixed FP for sizeof(int*[2])
This commit is contained in:
parent
562387e3ff
commit
29e74222fb
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Reference in New Issue