Fixed #8796 (Tokenizer::simplifyCompoundAssignment: Wrong simplification of return)
This commit is contained in:
parent
ab985f624c
commit
14afc3fd3a
|
@ -4808,6 +4808,8 @@ void Tokenizer::simplifyCompoundAssignment()
|
|||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
if (!Token::Match(tok, "[;{}] (| *| (| %name%"))
|
||||
continue;
|
||||
if (tok->next()->str() == "return")
|
||||
continue;
|
||||
// backup current token..
|
||||
Token * const tok1 = tok;
|
||||
|
||||
|
|
|
@ -373,6 +373,9 @@ private:
|
|||
|
||||
// #7571
|
||||
ASSERT_EQUALS("; foo = foo + [ & ] ( ) { } ;", tok("; foo += [&]() {int i;};"));
|
||||
|
||||
// #8796
|
||||
ASSERT_EQUALS("{ return ( a = b ) += c ; }", tok("{ return (a = b) += c; }"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue