[clang] [Clang] Handle ?: operator in fold expression (PR #164019)

Azmat Yusuf via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 10:07:04 PST 2025


azmat-y wrote:

> I’m not convinced this is the right approach; what if we have e.g.
> 
> ```c++
> template <typename ... T>
> void foo(T... Params) {
>   ([&]{ Params ?: 1; }(), ...);
> }
> ```
> will look into handling it in ActOnCXXFoldExpr instead and see if that helps
> We still crash on this and I’m sure `commonExpr` would still be pack-dependent in this case, but we don’t want this to become invalid.
> 
> I wonder if we should just delete the assertion in `computeDependence(OpaqueValueExpr*)`.

Commenting out the assert doesn't affect the test suite (check-clang), the tests still pass though I am unaware about any other implications of removing the assert. 

I thought of handling it through ActOnCXXFoldExpr earlier but the simpler case provided in the issue is not a fold at all, yet we still crash. I'll update when I think of another approach.

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


More information about the cfe-commits mailing list