diff --git a/lib/checksizeof.cpp b/lib/checksizeof.cpp index de8d9309e..944a47993 100644 --- a/lib/checksizeof.cpp +++ b/lib/checksizeof.cpp @@ -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 diff --git a/test/testsizeof.cpp b/test/testsizeof.cpp index f13b6fe71..bfb9d1309 100644 --- a/test/testsizeof.cpp +++ b/test/testsizeof.cpp @@ -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());