parent
4ce76d0b58
commit
3fdba645a6
|
@ -2445,8 +2445,14 @@ void CheckOther::checkDuplicateExpression()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
auto isInsideLambdaCaptureList = [](const Token* tok) {
|
||||||
|
const Token* parent = tok->astParent();
|
||||||
|
while (Token::simpleMatch(parent, ","))
|
||||||
|
parent = parent->astParent();
|
||||||
|
return isLambdaCaptureList(parent);
|
||||||
|
};
|
||||||
ErrorPath errorPath;
|
ErrorPath errorPath;
|
||||||
if (tok->isOp() && tok->astOperand1() && !Token::Match(tok, "+|*|<<|>>|+=|*=|<<=|>>=") && !isLambdaCaptureList(tok->astParent())) {
|
if (tok->isOp() && tok->astOperand1() && !Token::Match(tok, "+|*|<<|>>|+=|*=|<<=|>>=") && !isInsideLambdaCaptureList(tok)) {
|
||||||
if (Token::Match(tok, "==|!=|-") && astIsFloat(tok->astOperand1(), true))
|
if (Token::Match(tok, "==|!=|-") && astIsFloat(tok->astOperand1(), true))
|
||||||
continue;
|
continue;
|
||||||
const bool pointerDereference = (tok->astOperand1() && tok->astOperand1()->isUnaryOp("*")) ||
|
const bool pointerDereference = (tok->astOperand1() && tok->astOperand1()->isUnaryOp("*")) ||
|
||||||
|
|
|
@ -4853,7 +4853,8 @@ private:
|
||||||
|
|
||||||
check("struct S {\n" // #11383
|
check("struct S {\n" // #11383
|
||||||
" void f() {\n"
|
" void f() {\n"
|
||||||
" auto l2 = [i = i]() { return i; };\n"
|
" int x = 42;"
|
||||||
|
" auto l2 = [i = i, x, y = 0]() { return i + x + y; };\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" int i;\n"
|
" int i;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
|
|
Loading…
Reference in New Issue