File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ void CheckSizeof::sizeofFunction()
379379 if (const Token *argument = tok->next ()->astOperand2 ()) {
380380 const Token *checkToken = argument->previous ();
381381 if (checkToken->tokType () == Token::eName)
382- break ;
382+ continue ;
383383 const Function * fun = checkToken->function ();
384384 // Don't report error if the function is overloaded
385385 if (fun && fun->nestedIn ->functionMap .count (checkToken->str ()) == 1 ) {
Original file line number Diff line number Diff line change @@ -206,6 +206,11 @@ class TestSizeof : public TestFixture {
206206 " };\n "
207207 " };" );
208208 ASSERT_EQUALS (" " , errout_str ());
209+
210+ check (" int g();\n "
211+ " size_t f1() { return sizeof(x[0]); }\n "
212+ " size_t f2() { return sizeof(g()); }\n " );
213+ ASSERT_EQUALS (" [test.cpp:3:22]: (warning) Found function call inside sizeof(). [sizeofFunctionCall]\n " , errout_str ());
209214 }
210215
211216 void sizeofForArrayParameter () {
You can’t perform that action at this time.
0 commit comments