[Bug c++/101144] New: Coroutine compiler error

victor.burckel at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jun 21 08:13:43 GMT 2021


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

            Bug ID: 101144
           Summary: Coroutine compiler error
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: victor.burckel at gmail dot com
  Target Milestone: ---

Hello,

When trying to await the following coroutine, I get a compiler internal error
> internal compiler error: in build_special_member_call, at cp/call.c:10157

See it on godbolt: https://godbolt.org/z/f178vEqc9

#include <coroutine>
#include <vector>
#include <string>

struct task {
  struct promise_type {
    auto initial_suspend() noexcept { return std::suspend_always{}; }
    auto final_suspend() noexcept { return std::suspend_always{}; }
    void return_void() {}
    task get_return_object() { return task{}; }
    void unhandled_exception() noexcept {}
  };

  ~task() noexcept {}

  bool await_ready() const noexcept { return false; }
  void await_suspend(std::coroutine_handle<>) noexcept {}
  void await_resume() noexcept {}
};

task f(const std::vector<std::string>&)
{
    co_return;
}

task g()
{
    co_await f({"2", "3"});
}


More information about the Gcc-bugs mailing list