Fixed #7247 (False positive CastAddressToIntegerAtReturn - returning std::string)

This commit is contained in:
Daniel Marjamäki 2015-12-31 18:53:07 +01:00
parent 350908d0e9
commit 98756ea7f5
2 changed files with 14 additions and 0 deletions

View File

@ -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;

View File

@ -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());
}
};