[PATCH] D33625: [coroutines] Diagnose invalid result types for `await_resume` and `await_suspend` and add missing conversions.

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 28 12:53:43 PDT 2017

EricWF marked an inline comment as done.
EricWF added inline comments.

Comment at: lib/Sema/SemaCoroutine.cpp:393
+    //   - await-suspend is the expression e.await_suspend(h), which shall be
+    //     a prvalue of type void or bool.
+    QualType RetType = AwaitSuspend->getType();
rsmith wrote:
> It looks like you're not checking the 'prvalue' part of this.
I thought so too. I'll add tests to make sure it's being handled correctly.
The following test should expose a lack of checking for `prvalues`, right?

template <class BoolTy>
struct TestAwait {
  bool await_ready();
  template <class F> BoolTy await_suspend(F); // expected-error
  void await_resume();
void test() {
  co_await TestAwait<bool&&>{};
  co_await TestAwait<bool&>{}; 


More information about the cfe-commits mailing list