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

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Sun May 28 13:31:28 PDT 2017


On 28 May 2017 at 12:53, Eric Fiselier via Phabricator <
reviews at reviews.llvm.org> wrote:

> 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&>{};
> }
> ```
>

Yes. (I would also try some cv-qualified cases, with and without the
reference, just for completeness.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170528/7138c221/attachment.html>


More information about the cfe-commits mailing list