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

Azmat Yusuf via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 12:00:26 PDT 2026


================
@@ -12,3 +12,8 @@ template <typename... U> struct A {
     foo<T>((... + static_cast<U>(1))); // expected-error {{expression contains unexpanded parameter pack 'T'}}
   }
 };
+
+template <typename ... T>
+void foo(T... Params) {
+  (Params ?: 1, ...); // expected-error {{expression not permitted as operand of fold expression}}
----------------
azmat-y wrote:

I will add the additional tests after we get a concrete fix. A note telling the user that the gnu operator is not a valid fold operator will be good I think?

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


More information about the cfe-commits mailing list