public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94760] New: coroutines: mismatch between traits and promise parameter preview.
@ 2020-04-25 14:54 iains at gcc dot gnu.org
  2020-04-25 15:00 ` [Bug c++/94760] " iains at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: iains at gcc dot gnu.org @ 2020-04-25 14:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94760

            Bug ID: 94760
           Summary: coroutines: mismatch between traits and promise
                    parameter preview.
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---

Created attachment 48374
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48374&action=edit
fix under test

There was considerable confusion about how the various implementations
had interpreted the passing of 'this' and lambda capture object
pointers to traits lookup and the promise methods (constructor and
allocator)

In response, we changed the argument passed to the promise parameter
preview to match a reference to *this.  That has made things inconsistent
and we need to match it in the traits

the following code should compile, but fails unable to find a suitable
promise CTOR.

====

struct Fake {} ;

template<typename R, typename CallOp, typename ...T>
struct std::coroutine_traits<R, CallOp, T...> {
    struct promise_type {
        promise_type (CallOp op, T ...args) {}
        Fake get_return_object() { return {}; }
        std::suspend_always initial_suspend() { return {}; }
        std::suspend_never final_suspend() { return {}; }
        void return_void() {}
        void unhandled_exception() {}
    };
};


struct Foo
{
  Fake operator() (int a) {
    co_return;
  }
};

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-28  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25 14:54 [Bug c++/94760] New: coroutines: mismatch between traits and promise parameter preview iains at gcc dot gnu.org
2020-04-25 15:00 ` [Bug c++/94760] " iains at gcc dot gnu.org
2020-04-28  2:24 ` cvs-commit at gcc dot gnu.org
2020-04-28  8:20 ` iains at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).