Issue 76884
Summary Clang assert when capturing constant block in own initializer
Labels clang
Assignees
Reporter ellishg
    Clang crashes when trying to capture a constant block in its own initializer. If clang can't handle this case, it should fail with a diagnostic instead of crashing only in assert builds. The crash goes away if `const` is removed.

```objc
#import <Foundation/Foundation.h>

NSUInteger bar(void (^captured)(void));

void foo()
{
  // Remove "const" to fix the crash
  __block const NSUInteger crashing_block = bar(^{
 (void)crashing_block;
  });
}
```

```
clang main.mm -c -fblocks -target arm64-apple-macosx -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to