[clang] Fix crash and improve diagnostics for void lambda returns (PR #188904)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 2 06:50:56 PDT 2026


================
@@ -3676,6 +3676,7 @@ StmtResult Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc,
         // though we represent it as one). We still deduce 'void'.
         Diag(ReturnLoc, diag::err_lambda_return_init_list)
           << RetValExp->getSourceRange();
+          RetValExp = nullptr; 
----------------
Sirraide wrote:

```suggestion
        RetValExp = nullptr; 
```

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


More information about the cfe-commits mailing list