[clang] [Clang] Fix assertion when __block is used on global variables in C mode (PR #194856)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri May 1 04:28:59 PDT 2026


AaronBallman wrote:

> @AaronBallman @JustinStitt After some research, I now believe there's a more precise fix.

Thank you for the analysis!

> So the problem is now clear, and I think we should discuss whether we should retain this invalid `BlockAttr` in the `AST`.

I think we should drop the attribute from the AST. We're in an error recovery situation and the rest of the compiler should not have to guard against finding the attribute when it's not valid anyway. (Also, if we were emitting a warning instead of an error, it would almost certainly be an "attribute ignored" warning and those drop the attributes, so this is not an uncommon thing for us to do in these circumstances.)

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


More information about the cfe-commits mailing list