[clang] [Clang] Fix error recovery for default arguments (PR #208868)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 13 17:46:33 PDT 2026
================
@@ -46,3 +46,14 @@ template <class T> void f();
template <> void f<int>(int = []{ ; return 0; }()) {} // expected-error{{no function template matches function template specialization 'f'}} \
// expected-note at -1{{candidate template ignored}}
}
+
+//PR208868
+struct Y {};
+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<Y>(e1) == 42, ""); // expected-error {{no matching function for call to 'foo'}}
----------------
gtrong wrote:
Thanks for the suggestion! I've updated it.
https://github.com/llvm/llvm-project/pull/208868
More information about the cfe-commits
mailing list