Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -2108,6 +2108,7 @@ case tok::l_square: parseSquare(); break; + case tok::kw_auto: case tok::kw_class: case tok::kw_template: case tok::kw_typename: Index: clang/unittests/Format/TokenAnnotatorTest.cpp =================================================================== --- clang/unittests/Format/TokenAnnotatorTest.cpp +++ clang/unittests/Format/TokenAnnotatorTest.cpp @@ -749,6 +749,13 @@ EXPECT_TOKEN(Tokens[5], tok::l_brace, TT_LambdaLBrace); } +TEST_F(TokenAnnotatorTest, UnderstandsTrailingReturnTypeAutoInLabmdas) { + auto Tokens = annotate("[]() -> auto {}"); + ASSERT_EQ(Tokens.size(), 9u) << Tokens; + EXPECT_TOKEN(Tokens[4], tok::arrow, TT_LambdaArrow); + EXPECT_TOKEN(Tokens[6], tok::l_brace, TT_LambdaLBrace); +} + } // namespace } // namespace format } // namespace clang