diff --git a/lib/check64bit.cpp b/lib/check64bit.cpp index ebdbcdf13..02ba33e4a 100644 --- a/lib/check64bit.cpp +++ b/lib/check64bit.cpp @@ -53,6 +53,12 @@ void Check64BitPortability::pointerassignment() continue; for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) { + // skip nested functions + if (tok->str() == "{") { + if (tok->scope()->type == Scope::ScopeType::eFunction) + tok = tok->link(); + } + if (tok->str() != "return") continue; diff --git a/test/test64bit.cpp b/test/test64bit.cpp index f703817dc..031856b5f 100644 --- a/test/test64bit.cpp +++ b/test/test64bit.cpp @@ -201,6 +201,14 @@ private: " return mmio + (port_no * 0x80);\n" "}"); ASSERT_EQUALS("", errout.str()); + + // #7247 : dont check return statements in nested functions.. + check("int foo() {\n" + " struct {\n" + " const char * name() { return \"abc\"; }\n" + " } table;\n" + "}"); + ASSERT_EQUALS("", errout.str()); } };