diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 3b19c1d9f..544d5f5ab 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3042,15 +3042,7 @@ void Tokenizer::simplifyFunctionParameters() { for (Token *tok = _tokens; tok; tok = tok->next()) { - if (tok->str() == "{") - { - tok = tok->link(); - if (!tok) - break; - continue; - } - - if (tok->str() == "(") + if (tok->str() == "{" || tok->str() == "[" || tok->str() == "(") { tok = tok->link(); if (!tok) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index d34d68a56..e8341aae4 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -1934,6 +1934,11 @@ private: void simplify_function_parameters() { + { + const char code[] = "char a [ ABC ( DEF ) ] ;"; + ASSERT_EQUALS(code, tokenizeAndStringify(code, true)); + } + ASSERT_EQUALS("void f ( int x ) { }", tokenizeAndStringify("void f(x) int x; { }", true)); ASSERT_EQUALS("void f ( int x , char y ) { }", tokenizeAndStringify("void f(x,y) int x; char y; { }", true));