public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104020] New: [coroutines] ICE in co_await function call with initializer_list arguments
@ 2022-01-14  6:34 me at xecycle dot info
  2022-04-17 10:43 ` [Bug c++/104020] " avi at scylladb dot com
  2022-04-18 19:05 ` iains at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: me at xecycle dot info @ 2022-01-14  6:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104020
           Summary: [coroutines] ICE in co_await function call with
                    initializer_list arguments
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: me at xecycle dot info
  Target Milestone: ---

Running example at https://godbolt.org/z/cEjTWPvYf, code with clang part
removed is:

#include <coroutine>
using std::coroutine_handle;
using std::suspend_always;
using std::suspend_never;

#include <initializer_list>
#include <string_view>

struct promise_t;

struct ret_t {
  using promise_type = promise_t;
};

struct promise_t {

  ret_t get_return_object() { return {}; }

  constexpr auto initial_suspend() noexcept { return suspend_never(); }

  void return_void() {}
  auto final_suspend() noexcept { return suspend_never(); }

  void unhandled_exception()
  {
    __builtin_trap();
  }

};

auto operator co_await(ret_t)
{
  struct W {
    auto await_ready() { return std::true_type(); }
    void await_suspend(coroutine_handle<>) {}
    void await_resume() {}
  };
  return W();
}

ret_t f1(std::initializer_list<std::string_view>)
{
  co_return;
}

ret_t f2()
{
  co_await f1({"abc", "def"});
}

ICE in 11.2, "array used as initializer" in trunk.

Can compile if either:
- the argument is std::initializer_list<int>, or
- use a separate variable, like
  std::initializer_list<std::string_view> args {"abc", "def"};
  co_await f1(args);

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

* [Bug c++/104020] [coroutines] ICE in co_await function call with initializer_list arguments
  2022-01-14  6:34 [Bug c++/104020] New: [coroutines] ICE in co_await function call with initializer_list arguments me at xecycle dot info
@ 2022-04-17 10:43 ` avi at scylladb dot com
  2022-04-18 19:05 ` iains at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: avi at scylladb dot com @ 2022-04-17 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

Avi Kivity <avi at scylladb dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |avi at scylladb dot com

--- Comment #1 from Avi Kivity <avi at scylladb dot com> ---
Duplicate of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056

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

* [Bug c++/104020] [coroutines] ICE in co_await function call with initializer_list arguments
  2022-01-14  6:34 [Bug c++/104020] New: [coroutines] ICE in co_await function call with initializer_list arguments me at xecycle dot info
  2022-04-17 10:43 ` [Bug c++/104020] " avi at scylladb dot com
@ 2022-04-18 19:05 ` iains at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: iains at gcc dot gnu.org @ 2022-04-18 19:05 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iains at gcc dot gnu.org
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
As Avi says, this is a dup of 98056.

*** This bug has been marked as a duplicate of bug 98056 ***

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

end of thread, other threads:[~2022-04-18 19:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14  6:34 [Bug c++/104020] New: [coroutines] ICE in co_await function call with initializer_list arguments me at xecycle dot info
2022-04-17 10:43 ` [Bug c++/104020] " avi at scylladb dot com
2022-04-18 19:05 ` 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).