Author: owenca Date: 2026-03-13T19:21:52-07:00 New Revision: 5c38a682cc220a48c209f4f9a434605c65a02064
URL: https://github.com/llvm/llvm-project/commit/5c38a682cc220a48c209f4f9a434605c65a02064 DIFF: https://github.com/llvm/llvm-project/commit/5c38a682cc220a48c209f4f9a434605c65a02064.diff LOG: [clang-format] Fix an assertion failure on invalid C++ lambda (#185349) Fixes #185268 Added: Modified: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 1b588435d6302..965c9195aa7f4 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -4147,7 +4147,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const { if (Tok->is(TT_CtorInitializerColon)) break; if (Tok->is(tok::arrow)) { - Tok->setType(TT_TrailingReturnArrow); + Tok->overwriteFixedType(TT_TrailingReturnArrow); break; } if (Tok->isNot(TT_TrailingAnnotation)) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 63edc17b6da25..d066b3f482b21 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -29354,6 +29354,10 @@ TEST_F(FormatTest, UnbalancedAngleBrackets) { getLLVMStyleWithColumns(50)); } +TEST_F(FormatTest, LambdaArrowAsTrailingReturnArrow) { + verifyNoCrash("void foo()([] consteval -> int {}())"); +} + } // namespace } // namespace test } // namespace format _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
