diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1786,6 +1786,9 @@ case tok::l_paren: parseParens(); break; + case tok::l_square: + parseSquare(); + break; case tok::amp: case tok::star: case tok::kw_const: diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -20232,6 +20232,11 @@ "};"); verifyFormat("[]() -> Void {};"); verifyFormat("[a, b]() -> Tuple { return {}; };"); + verifyFormat("SomeFunction({[]() -> int[] { return {}; }});"); + verifyFormat("SomeFunction({[]() -> int *[] { return {}; }});"); + verifyFormat("SomeFunction({[]() -> int (*)[] { return {}; }});"); + verifyFormat("SomeFunction({[]() -> ns::type { return {}; }});"); + verifyFormat("return int{[x = x]() { return x; }()};"); // Lambdas with explicit template argument lists. verifyFormat(