[clang] [Clang] Fix error recovery for default arguments (PR #208868)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 23:01:25 PDT 2026


================
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++14 -verify %s
+
+struct S {};
+enum E { e1, e2 };
+
+template<typename T>
+auto foo(E = ({ ; }) ? 0 : 1, E = e2) {  // expected-error {{default argument may not use a GNU statement expression}}
+  return 42;
+}
+
+static_assert(foo<S>(e1) == 42, ""); // expected-error {{no matching function for call to 'foo'}}
----------------
mizvekov wrote:

Missing newline at end of file.

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


More information about the cfe-commits mailing list