[clang] [Clang][Parse] Fix crash on a coroutine keyword in a mem-initializer (PR #218168)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 31 03:57:12 PDT 2026
================
@@ -1566,3 +1566,10 @@ void g() {
}
}
+
+namespace GH194298 {
+coro<promise_void> f1() : bar { co_await suspend_always{} }; // expected-error {{only constructors take base initializers}}
+coro<promise> f2() : bar { co_yield 0 }; // expected-error {{only constructors take base initializers}}
+coro<promise_void> f3() : bar { co_return }; // expected-error {{expected expression}} \
+ // expected-error {{only constructors take base initializers}}
+}
----------------
cor3ntin wrote:
Can you add tests for
- co_await in a function try blocks
- the same tests as above for a member function
Thanks
https://github.com/llvm/llvm-project/pull/218168
More information about the cfe-commits
mailing list