================
@@ -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)) {
+      Diag(ReturnLoc, diag::err_return_block_has_expr)
+          << (getCurLambda() != nullptr);
----------------
Sirraide wrote:

```suggestion
          << (CurLambda != nullptr);
```
Ah here as well

https://github.com/llvm/llvm-project/pull/188904
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to