diff --git a/lib/check64bit.cpp b/lib/check64bit.cpp index 81fc94610..65018177b 100644 --- a/lib/check64bit.cpp +++ b/lib/check64bit.cpp @@ -65,7 +65,7 @@ void Check64BitPortability::pointerassignment() continue; for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) { - if (Token::Match(tok, "return %var%|%num% [;+]")) { + if (Token::Match(tok, "return %var%|%num% [;+]") && !Token::simpleMatch(tok, "return 0 ;")) { enum { NO, INT, PTR, PTRDIFF } type = NO; for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) { if ((type == NO || type == INT) && isaddr(tok2->variable())) diff --git a/test/test64bit.cpp b/test/test64bit.cpp index 2919ddc8f..22eb6ba1f 100644 --- a/test/test64bit.cpp +++ b/test/test64bit.cpp @@ -151,6 +151,11 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + check("void* foo() {\n" + " return 0;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + check("int foo(int i) {\n" " return i;\n" "}\n");