From 66d0d7a0ad0aa3e553b04089e34dd9e7a013a2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 29 Jul 2016 21:53:58 +0200 Subject: [PATCH] Fixed #7553 (False positive with 1.74 'returning an integer in a function with pointer return type' when no integer is used) --- lib/check64bit.cpp | 2 +- test/test64bit.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/check64bit.cpp b/lib/check64bit.cpp index bb3e86732..68197b682 100644 --- a/lib/check64bit.cpp +++ b/lib/check64bit.cpp @@ -73,7 +73,7 @@ void Check64BitPortability::pointerassignment() if (!returnType) continue; - if (retPointer && returnType->pointer == 0U) + if (retPointer && !returnType->typeScope && returnType->pointer == 0U) returnIntegerError(tok); if (!retPointer && returnType->pointer >= 1U) diff --git a/test/test64bit.cpp b/test/test64bit.cpp index dce3019fd..cd0c9020e 100644 --- a/test/test64bit.cpp +++ b/test/test64bit.cpp @@ -168,6 +168,13 @@ private: "}"); ASSERT_EQUALS("", errout.str()); + check("struct Foo {};\n" + "\n" + "int* dostuff(Foo foo) {\n" + " return foo;\n" + "}"); + ASSERT_EQUALS("", errout.str()); + check("int foo(char* c) {\n" " return c;\n" "}");