[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:53:49 PDT 2026


================
@@ -387,12 +387,16 @@ Bug Fixes in This Version
 - Correctly diagnosing and no longer crashing when ``export module foo``
   (without a semicolon) are the final tokens in a module file. (#GH187771)
 - Fixed a crash in duplicate attribute checking caused by comparing constant arguments with different integer signedness. (#GH188259)
+- Fixed a crash when returning an initializer list from a void lambda or block.
+  The compiler now emits a proper error message that correctly says "lambda"
+  instead of "block" when applicable. (GH188661)
----------------
Sirraide wrote:

Also, this message should not say ‘fixed a crash’; we weren’t crashing on this before; we just didn’t diagnose it. I think a better release note would be something like ‘Clang now emits an error when attempting to return an initializer list from a lambda with an explicit return type of `void`; the diagnostic for this now also says “lambda” instead of “block”’

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


More information about the cfe-commits mailing list