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

Azmat Yusuf via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 30 05:09:37 PST 2025


================
@@ -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:

Sorry for the late response, I've been busy with college and such. Do you mean the test itself? Or the diagnostic? g++ diagnostic shows the caret on the conditional operator, should we do something similar here?

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


More information about the cfe-commits mailing list