Support lambdas in simplifyCompoundAssignment (#7571)
This commit is contained in:
parent
87372ccd58
commit
a808549af0
|
@ -4659,7 +4659,7 @@ void Tokenizer::simplifyCompoundAssignment()
|
|||
// Only enclose rhs in parentheses if there is some operator
|
||||
bool someOperator = false;
|
||||
for (Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
||||
if (tok2->str() == "(")
|
||||
if (tok2->link() && Token::Match(tok2, "{|[|("))
|
||||
tok2 = tok2->link();
|
||||
|
||||
if (Token::Match(tok2->next(), "[;)]")) {
|
||||
|
|
|
@ -362,6 +362,9 @@ private:
|
|||
|
||||
// #3469
|
||||
ASSERT_EQUALS("; a = a + ( b = 1 ) ;", tok("; a += b = 1;"));
|
||||
|
||||
// #7571
|
||||
ASSERT_EQUALS("; foo = foo + [ & ] ( ) { } ;", tok("; foo += [&]() {int i;};"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue