[Bug c++/101144] Coroutine compiler error

2021-09-30 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101144

Iain Sandoe  changed:

   What|Removed |Added

 CC||iains at gcc dot gnu.org
 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #2 from Iain Sandoe  ---
duplicate of 98056

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

[Bug c++/101144] Coroutine compiler error

2021-08-31 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101144

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed||2021-08-31
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

[Bug c++/101144] Coroutine compiler error

2021-08-30 Thread liuyaoxin1976 at qq dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101144

Yaoxin Liu  changed:

   What|Removed |Added

 CC||liuyaoxin1976 at qq dot com

--- Comment #1 from Yaoxin Liu  ---
#include 
#include 
#include 

using namespace std::literals;

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

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

task f(std::vector) { co_return; }

task f(std::vector) { co_return; }

task g() {
  co_await f(std::vector{1, 2, 3});  // ok
  co_await f(std::vector{}); // ok

  auto s1 = "hello1"s;
  auto s2 = "hello2"s;
  auto s3 = "hello3"s;
  co_await f(std::vector{s1, s2, s3}); // error
}

See https://godbolt.org/z/z9x8Y96j6