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

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 08:57:15 PDT 2026


================
@@ -1510,7 +1510,7 @@ static void CheckFoldOperand(Sema &S, Expr *E) {
   E = E->IgnoreImpCasts();
   auto *OCE = dyn_cast<CXXOperatorCallExpr>(E);
   if ((OCE && OCE->isInfixBinaryOp()) || isa<BinaryOperator>(E) ||
-      isa<AbstractConditionalOperator>(E)) {
+      isa<AbstractConditionalOperator>(E) || isa<RecoveryExpr>(E)) {
----------------
cor3ntin wrote:

This is worth exploring but we should not break this example

```
template <typename ... T>
void foo(T... Params) {
  ([&]{ Params ?: 1; }(), ...);
}

```

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


More information about the cfe-commits mailing list