From c2305b1da7a0e1c640c3bc9499c562f7317587b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 10 Aug 2021 09:55:16 +0200 Subject: [PATCH] Fixed #10396 (FP missingReturn on void operator=()) --- lib/symboldatabase.cpp | 2 +- test/testfunctions.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 7bb744030..3e394d443 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2692,7 +2692,7 @@ bool Function::returnsVoid(const Function* function, bool unknown) { if (!function) return false; - if (function->type != Function::eFunction) + if (function->type != Function::eFunction && function->type != Function::eOperatorEqual) return false; const Token* defEnd = function->returnDefEnd(); if (defEnd->strAt(-1) == "void") diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index 8ee5db901..06dca67cf 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -1398,6 +1398,9 @@ private: check("void STDCALL foo() {}"); ASSERT_EQUALS("", errout.str()); + check("void operator=(int y) { x=y; }"); + ASSERT_EQUALS("", errout.str()); + check("int f() {\n" "back:\n" " return 0;\n"