diff --git a/lib/checksizeof.cpp b/lib/checksizeof.cpp index e4e79de47..73bb5cd8b 100644 --- a/lib/checksizeof.cpp +++ b/lib/checksizeof.cpp @@ -33,8 +33,8 @@ namespace { // CWE IDs used: static const struct CWE CWE398(398U); // Indicator of Poor Code Quality -static const struct CWE CWE467(467U); // Use of sizeof() on a Pointer Type -static const struct CWE CWE682(682U); // Incorrect Calculation +static const struct CWE CWE467(467U); // Use of sizeof() on a Pointer Type +static const struct CWE CWE682(682U); // Incorrect Calculation //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- void CheckSizeof::checkSizeofForNumericParameter() diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index e38b8c9a9..b6c2908fe 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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(), "[;)]")) { diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 1c005f79e..8b4b75e86 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -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;};")); }