Fixed #10396 (FP missingReturn on void operator=())

This commit is contained in:
Daniel Marjamäki 2021-08-10 09:55:16 +02:00
parent d0b6079a83
commit c2305b1da7
2 changed files with 4 additions and 1 deletions

View File

@ -2692,7 +2692,7 @@ bool Function::returnsVoid(const Function* function, bool unknown)
{ {
if (!function) if (!function)
return false; return false;
if (function->type != Function::eFunction) if (function->type != Function::eFunction && function->type != Function::eOperatorEqual)
return false; return false;
const Token* defEnd = function->returnDefEnd(); const Token* defEnd = function->returnDefEnd();
if (defEnd->strAt(-1) == "void") if (defEnd->strAt(-1) == "void")

View File

@ -1398,6 +1398,9 @@ private:
check("void STDCALL foo() {}"); check("void STDCALL foo() {}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("void operator=(int y) { x=y; }");
ASSERT_EQUALS("", errout.str());
check("int f() {\n" check("int f() {\n"
"back:\n" "back:\n"
" return 0;\n" " return 0;\n"