[clang] [Clang] [Sema] Don't crash on unexpanded pack in invalid block literal (PR #110762)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 08:51:03 PDT 2024


Sirraide wrote:

> I am not sure i understand that.
>
> Imo the issue is that `DiagnoseUnexpandedParameterPacks` (where we set `LambdaScopeInfo::ContainsUnexpandedParameterPack` does not account for blocks - and probably should.
> 
> Ideally
> 
> * DiagnoseUnexpandedParameterPacks would handle arbitrary capturing-scope thingies (statement expressions, lambdas, blocks, eventually do expressions, and other terrifying such constructs)
> * Once the innermost such construct is fully constructed, the `ContainsUnexpandedParameterPack` flag could bubble upward to the enclosing capturing scope

Yeah, that’s also what I figured initially. I just assumed that there was *some* reason why blocks don’t or can’t work that way (I have never used Objective-C and I candidly don’t know a lot about blocks...), but it seems that there isn’t.

So if you think that this is a better idea, I can instead look into refactoring blocks to work the same way as lambdas wrt `DiagnoseUnexpandedParameterPacks()` (and I think that mainly just means moving some things from `LambdaScopeInfo` to `CapturingScopeInfo` or whatever the base class was called again and making `DiagnoseUnexpandedParameterPacks()` etc. use that instead).

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


More information about the cfe-commits mailing list