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

Kartik Ohlan via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 07:32:08 PDT 2026


================
@@ -3715,15 +3715,18 @@ StmtResult Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc,
     // Delay processing for now.  TODO: there are lots of dependent
     // types we can conclusively prove aren't void.
   } else if (FnRetType->isVoidType()) {
-    if (RetValExp && !isa<InitListExpr>(RetValExp) &&
-        !(getLangOpts().CPlusPlus &&
-          (RetValExp->isTypeDependent() ||
-           RetValExp->getType()->isVoidType()))) {
-      if (!getLangOpts().CPlusPlus &&
-          RetValExp->getType()->isVoidType())
+    if (RetValExp && isa<InitListExpr>(RetValExp)) {
----------------
Ko496-glitch wrote:

done

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


More information about the cfe-commits mailing list