diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 9f771feff..832db5f20 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2689,6 +2689,15 @@ bool Function::returnsVoid(const Function* function, bool unknown) // Check for unknown types, which could be a void type if (isUnknownType(function->retDef, defEnd)) return unknown; + if (unknown) { + // void STDCALL foo() + const Token *def; + bool isVoid = false; + for (def = function->retDef; def && def->isName(); def = def->next()) + isVoid |= (def->str() == "void"); + if (isVoid && def && !Token::Match(def, "*|&|&&")) + return true; + } return false; } diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index b3495c0cf..3230829f6 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -1379,6 +1379,9 @@ private: check("auto foo4() -> void {}"); ASSERT_EQUALS("", errout.str()); + check("void STDCALL foo() {}"); + ASSERT_EQUALS("", errout.str()); + check("int f() {\n" "back:\n" " return 0;\n"