diff --git a/simplecpp.cpp b/simplecpp.cpp index a7ced05a..116b71ce 100644 --- a/simplecpp.cpp +++ b/simplecpp.cpp @@ -1025,7 +1025,7 @@ void simplecpp::TokenList::combineOperators() continue; } const Token *prev = tok->previous; - while (prev && prev->isOneOf(";{}()")) + while (prev && prev->isOneOf(";{}(")) prev = prev->previous; executableScope.push(prev && prev->op == ')'); continue; diff --git a/test.cpp b/test.cpp index cd6a4db5..51eee781 100644 --- a/test.cpp +++ b/test.cpp @@ -493,6 +493,7 @@ static void combineOperators_andequal() ASSERT_EQUALS("x &= 2 ;", preprocess("x &= 2;")); ASSERT_EQUALS("void f ( x & = 2 ) ;", preprocess("void f(x &= 2);")); ASSERT_EQUALS("f ( x &= 2 ) ;", preprocess("f(x &= 2);")); + ASSERT_EQUALS("f ( ) { return new int ( i &= 1 ) ; }", preprocess("f () { return new int(i &= 1); }")); } static void combineOperators_ellipsis()