[clang] [clang-format] Fix a bug in parsing C-style cast of lambdas (PR #136099)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 18 22:47:24 PDT 2025


================
@@ -2371,7 +2371,8 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
   if ((Previous && ((Previous->Tok.getIdentifierInfo() &&
                      !Previous->isOneOf(tok::kw_return, tok::kw_co_await,
                                         tok::kw_co_yield, tok::kw_co_return)) ||
-                    Previous->closesScope())) ||
+                    (Previous->closesScope() &&
+                     !Previous->endsSequence(tok::r_paren, tok::greater)))) ||
----------------
owenca wrote:

I've added the handling of casting to a function pointer, the only other case I can think of.

https://github.com/llvm/llvm-project/pull/136099


More information about the cfe-commits mailing list