diff --git a/lib/checkother.cpp b/lib/checkother.cpp index da1c5a34f..cf43bff0f 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -3126,6 +3126,8 @@ void CheckOther::checkKnownArgument() } return ChildrenToVisit::none; } + if (Token::simpleMatch(child->previous(), "sizeof (")) + return ChildrenToVisit::none; return ChildrenToVisit::op1_and_op2; }); if (varexpr.empty()) diff --git a/test/testother.cpp b/test/testother.cpp index 218e41909..a8c5719d1 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -8830,6 +8830,13 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + check("char *yytext;\n" + "void re_init_scanner() {\n" + " int size = 256;\n" + " yytext = xmalloc(size * sizeof *yytext);\n" + "}"); + ASSERT_EQUALS("", errout.str()); + // #8986 check("void f(int);\n" "void g() {\n"