Check64BitPortability::pointerassignment(): Skip over lambdas (#7451)
This commit is contained in:
parent
b65cacf4b1
commit
21b51dd235
|
@ -59,7 +59,7 @@ void Check64BitPortability::pointerassignment()
|
|||
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)
|
||||
if (tok->scope()->type == Scope::ScopeType::eFunction || tok->scope()->type == Scope::ScopeType::eLambda)
|
||||
tok = tok->link();
|
||||
}
|
||||
|
||||
|
|
|
@ -202,13 +202,21 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #7247 : dont check return statements in nested functions..
|
||||
// #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());
|
||||
|
||||
// #7451: Lambdas
|
||||
check("const int* test(std::vector<int> outputs, const std::string& text) {\n"
|
||||
" auto it = std::find_if(outputs.begin(), outputs.end(), \n"
|
||||
" [&](int ele) { return \"test\" == text; });\n"
|
||||
" return nullptr;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue