[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 06:02:00 PST 2024


================
@@ -12,6 +12,13 @@ struct task {
     std::suspend_always yield_value(int) { return {}; }
     task get_return_object();
     void unhandled_exception();
+
+    struct Awaiter {
+      bool await_ready();
+      void await_suspend(auto);
+      int await_resume();
+    };
+    auto await_transform(const int& x) { return Awaiter{}; }
----------------
hokein wrote:

We have a testcase `int a = co_await 1;` where the return type of `await_resume` needs to be `intt`, `std::suspend_always` is not sufficient enough for it.

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


More information about the cfe-commits mailing list